use of ca.nrc.cadc.caom2.wcs.RefCoord in project caom2db by opencadc.
the class AbstractObservationDAOTest method getCustomChunk.
private Chunk getCustomChunk(boolean full) {
Chunk c = new Chunk();
c.metaProducer = URI.create("test:chunk/roundrip-1.0");
if (full)
c.productType = ProductType.SCIENCE;
c.customAxis = new Integer(1);
c.custom = new CustomWCS(new CoordAxis1D(new Axis("FDEP", "flibbles")));
c.custom.getAxis().range = new CoordRange1D(new RefCoord(100.0, 1.0), new RefCoord(900.0, 200.0));
c.custom.getAxis().bounds = new CoordBounds1D();
c.custom.getAxis().bounds.getSamples().add(new CoordRange1D(new RefCoord(100.0, 100.0), new RefCoord(400.0, 140.0)));
c.custom.getAxis().bounds.getSamples().add(new CoordRange1D(new RefCoord(600.0, 160.0), new RefCoord(900.0, 200.0)));
c.custom.getAxis().function = new CoordFunction1D(1024L, 1.0, new RefCoord(1.0, 1.0));
return c;
}
use of ca.nrc.cadc.caom2.wcs.RefCoord in project caom2db by opencadc.
the class AbstractObservationDAOTest method getSpecChunk.
private Chunk getSpecChunk(boolean full) {
Chunk c = new Chunk();
c.metaProducer = URI.create("test:chunk/roundrip-1.0");
if (full)
c.productType = ProductType.SCIENCE;
c.energyAxis = new Integer(1);
c.energy = new SpectralWCS(new CoordAxis1D(new Axis("WAVE", "m")), "TOPOCENT");
c.energy.ssysobs = "TOPOCENT";
c.energy.ssyssrc = "TOPOCENT";
c.energy.restwav = 1.0e-6;
c.energy.resolvingPower = 50000.0;
RefCoord c1 = new RefCoord(0.5, 300.0e-9);
RefCoord c2 = new RefCoord(1024.0, 450.0e-9);
RefCoord c3 = new RefCoord(2048.5, 600.0e-9);
c.energy.getAxis().range = new CoordRange1D(c1, c3);
c.energy.getAxis().bounds = new CoordBounds1D();
c.energy.getAxis().bounds.getSamples().add(new CoordRange1D(c1, c2));
c.energy.getAxis().bounds.getSamples().add(new CoordRange1D(c2, c3));
c.energy.getAxis().function = new CoordFunction1D(1024L, (c3.val - c1.val) / 1024.0, c1);
return c;
}
use of ca.nrc.cadc.caom2.wcs.RefCoord in project caom2db by opencadc.
the class CaomRepoIntTests method testPutInvalidWCS.
@Test
public void testPutInvalidWCS() throws Throwable {
String observationID = generateID("testPostInvalidWCS");
SimpleObservation observation = new SimpleObservation(TEST_COLLECTION, observationID);
Plane plane = new Plane("foo");
observation.getPlanes().add(plane);
// computation test looks at science artifacts; we want to test that complete WCS validation works
plane.getArtifacts().add(new Artifact(new URI("ad:TEST/foo"), ProductType.SCIENCE, ReleaseType.DATA));
Artifact invalid = new Artifact(new URI("ad:TEST/bar"), ProductType.AUXILIARY, ReleaseType.DATA);
plane.getArtifacts().add(invalid);
Part part = new Part(0);
invalid.getParts().add(part);
Chunk ch = new Chunk();
part.getChunks().add(ch);
ch.naxis = 1;
ch.energyAxis = 1;
ch.energy = new SpectralWCS(new CoordAxis1D(new Axis("FREQ", "Hz")), "TOPOCENT");
// set delta to 0
// 100MHz
ch.energy.getAxis().function = new CoordFunction1D(10L, 0.0, new RefCoord(0.5, 100.0e6));
observation.getPlanes().add(plane);
putObservation(observation, subject1, 400, "invalid input: ", null);
}
use of ca.nrc.cadc.caom2.wcs.RefCoord in project caom2db by opencadc.
the class CaomRepoIntTests23 method testPutSuccessWCS.
@Test
public void testPutSuccessWCS() throws Throwable {
String observationID = generateID("testPutSuccessWCS");
// put an observation using subject1
SimpleObservation observation = new SimpleObservation(TEST_COLLECTION, observationID);
Plane plane = new Plane("foo");
observation.getPlanes().add(plane);
Artifact artifact = new Artifact(new URI("ad:TEST/foo"), ProductType.SCIENCE, ReleaseType.DATA);
plane.getArtifacts().add(artifact);
Part part = new Part(0);
artifact.getParts().add(part);
Chunk ch = new Chunk();
part.getChunks().add(ch);
ch.naxis = 1;
ch.energyAxis = 1;
ch.energy = new SpectralWCS(new CoordAxis1D(new Axis("FREQ", "Hz")), "TOPOCENT");
// 100MHz
ch.energy.getAxis().function = new CoordFunction1D(10L, 1.0, new RefCoord(0.5, 100.0e6));
putObservation(observation, subject1, 200, "OK", null);
String path = TEST_COLLECTION + "/" + observationID;
String uri = SCHEME + path;
// cleanup (ok to fail)
deleteObservation(uri, subject1, null, null);
}
use of ca.nrc.cadc.caom2.wcs.RefCoord in project caom2db by opencadc.
the class CaomRepoIntTests23 method testPutInvalidWCS.
@Test
public void testPutInvalidWCS() throws Throwable {
String observationID = generateID("testPostInvalidWCS");
SimpleObservation observation = new SimpleObservation(TEST_COLLECTION, observationID);
Plane plane = new Plane("foo");
observation.getPlanes().add(plane);
// computation test looks at science artifacts; we want to test that complete WCS validation works
plane.getArtifacts().add(new Artifact(new URI("ad:TEST/foo"), ProductType.SCIENCE, ReleaseType.DATA));
Artifact invalid = new Artifact(new URI("ad:TEST/bar"), ProductType.AUXILIARY, ReleaseType.DATA);
plane.getArtifacts().add(invalid);
Part part = new Part(0);
invalid.getParts().add(part);
Chunk ch = new Chunk();
part.getChunks().add(ch);
// Use invalid cunit
ch.energy = new SpectralWCS(new CoordAxis1D(new Axis("FREQ", "Fred")), "TOPOCENT");
// set delta to 0
// 100MHz
ch.energy.getAxis().function = new CoordFunction1D(10L, 0.0, new RefCoord(0.5, 100.0e6));
observation.getPlanes().add(plane);
putObservation(observation, subject1, 400, "invalid input: ", null);
}
Aggregations