Search in sources :

Example 1 with RefCoord

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;
}
Also used : CoordAxis1D(ca.nrc.cadc.caom2.wcs.CoordAxis1D) CustomWCS(ca.nrc.cadc.caom2.wcs.CustomWCS) CoordRange1D(ca.nrc.cadc.caom2.wcs.CoordRange1D) RefCoord(ca.nrc.cadc.caom2.wcs.RefCoord) Chunk(ca.nrc.cadc.caom2.Chunk) CoordFunction1D(ca.nrc.cadc.caom2.wcs.CoordFunction1D) CoordBounds1D(ca.nrc.cadc.caom2.wcs.CoordBounds1D) ObservableAxis(ca.nrc.cadc.caom2.wcs.ObservableAxis) CustomAxis(ca.nrc.cadc.caom2.CustomAxis) Axis(ca.nrc.cadc.caom2.wcs.Axis)

Example 2 with RefCoord

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;
}
Also used : CoordAxis1D(ca.nrc.cadc.caom2.wcs.CoordAxis1D) SpectralWCS(ca.nrc.cadc.caom2.wcs.SpectralWCS) CoordRange1D(ca.nrc.cadc.caom2.wcs.CoordRange1D) RefCoord(ca.nrc.cadc.caom2.wcs.RefCoord) Chunk(ca.nrc.cadc.caom2.Chunk) CoordFunction1D(ca.nrc.cadc.caom2.wcs.CoordFunction1D) CoordBounds1D(ca.nrc.cadc.caom2.wcs.CoordBounds1D) ObservableAxis(ca.nrc.cadc.caom2.wcs.ObservableAxis) CustomAxis(ca.nrc.cadc.caom2.CustomAxis) Axis(ca.nrc.cadc.caom2.wcs.Axis)

Example 3 with RefCoord

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);
}
Also used : CoordAxis1D(ca.nrc.cadc.caom2.wcs.CoordAxis1D) SpectralWCS(ca.nrc.cadc.caom2.wcs.SpectralWCS) Plane(ca.nrc.cadc.caom2.Plane) SimpleObservation(ca.nrc.cadc.caom2.SimpleObservation) Part(ca.nrc.cadc.caom2.Part) RefCoord(ca.nrc.cadc.caom2.wcs.RefCoord) Chunk(ca.nrc.cadc.caom2.Chunk) CoordFunction1D(ca.nrc.cadc.caom2.wcs.CoordFunction1D) URI(java.net.URI) Artifact(ca.nrc.cadc.caom2.Artifact) Axis(ca.nrc.cadc.caom2.wcs.Axis) Test(org.junit.Test)

Example 4 with RefCoord

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);
}
Also used : CoordAxis1D(ca.nrc.cadc.caom2.wcs.CoordAxis1D) SpectralWCS(ca.nrc.cadc.caom2.wcs.SpectralWCS) Plane(ca.nrc.cadc.caom2.Plane) SimpleObservation(ca.nrc.cadc.caom2.SimpleObservation) Part(ca.nrc.cadc.caom2.Part) RefCoord(ca.nrc.cadc.caom2.wcs.RefCoord) Chunk(ca.nrc.cadc.caom2.Chunk) CoordFunction1D(ca.nrc.cadc.caom2.wcs.CoordFunction1D) URI(java.net.URI) Artifact(ca.nrc.cadc.caom2.Artifact) Axis(ca.nrc.cadc.caom2.wcs.Axis) Test(org.junit.Test)

Example 5 with RefCoord

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);
}
Also used : CoordAxis1D(ca.nrc.cadc.caom2.wcs.CoordAxis1D) SpectralWCS(ca.nrc.cadc.caom2.wcs.SpectralWCS) Plane(ca.nrc.cadc.caom2.Plane) SimpleObservation(ca.nrc.cadc.caom2.SimpleObservation) Part(ca.nrc.cadc.caom2.Part) RefCoord(ca.nrc.cadc.caom2.wcs.RefCoord) Chunk(ca.nrc.cadc.caom2.Chunk) CoordFunction1D(ca.nrc.cadc.caom2.wcs.CoordFunction1D) URI(java.net.URI) Artifact(ca.nrc.cadc.caom2.Artifact) Axis(ca.nrc.cadc.caom2.wcs.Axis) Test(org.junit.Test)

Aggregations

Axis (ca.nrc.cadc.caom2.wcs.Axis)10 RefCoord (ca.nrc.cadc.caom2.wcs.RefCoord)10 Chunk (ca.nrc.cadc.caom2.Chunk)9 CoordAxis1D (ca.nrc.cadc.caom2.wcs.CoordAxis1D)8 CoordFunction1D (ca.nrc.cadc.caom2.wcs.CoordFunction1D)7 CustomAxis (ca.nrc.cadc.caom2.CustomAxis)6 ObservableAxis (ca.nrc.cadc.caom2.wcs.ObservableAxis)6 SpectralWCS (ca.nrc.cadc.caom2.wcs.SpectralWCS)5 Artifact (ca.nrc.cadc.caom2.Artifact)4 Part (ca.nrc.cadc.caom2.Part)4 Plane (ca.nrc.cadc.caom2.Plane)4 SimpleObservation (ca.nrc.cadc.caom2.SimpleObservation)4 URI (java.net.URI)4 Test (org.junit.Test)4 CoordBounds1D (ca.nrc.cadc.caom2.wcs.CoordBounds1D)3 CoordRange1D (ca.nrc.cadc.caom2.wcs.CoordRange1D)3 Coord2D (ca.nrc.cadc.caom2.wcs.Coord2D)2 CoordAxis2D (ca.nrc.cadc.caom2.wcs.CoordAxis2D)2 SpatialWCS (ca.nrc.cadc.caom2.wcs.SpatialWCS)2 CoordError (ca.nrc.cadc.caom2.wcs.CoordError)1