src/test/java/ucar/geoapi/NetcdfCRSTest.java
@Test
    public void testProjected4D() throws IOException {
        try (NetcdfDataset file = openDataset(TestData.NETCDF_4D_PROJECTED)) {
            final List<CoordinateSystem> crsList = file.getCoordinateSystems();
            assertEquals("Unexpected number of netCDF coordinate systems.", 1, crsList.size());
            crs = wrap(crsList.get(0), file);
            final ProjectedCRS projected = separateComponents("Expected a (projected + vertical + time) CRS.", ProjectedCRS.class, true);
            final CartesianCS cart = projected  .getCoordinateSystem();
            final VerticalCS  vert = verticalCRS.getCoordinateSystem();
            final TimeCS      time = temporalCRS.getCoordinateSystem();
            assertAxisDirectionsEqual("ProjectedCRS.cs", cart, EAST, NORTH);
            assertAxisDirectionsEqual("VerticalCRS.cs",  vert, UP);
            assertAxisDirectionsEqual("TemporalCRS.cs",  time, FUTURE);
            assertAxisEquals("x0",   Units.KILOMETRE,          cart.getAxis(0));
            assertAxisEquals("y0",   Units.KILOMETRE,          cart.getAxis(1));
            assertAxisEquals("z0",   Units.FOOT.multiply(100), vert.getAxis(0));
            assertAxisEquals("time", Units.SECOND,             time.getAxis(0));
            assertNameEquals("time z0 y0 x0", crs);
            assertEquals("Time since 1992-1-1 UTC", new Date(0L), temporalCRS.getDatum().getOrigin());
            /*
             * Following part is specific to ProjectedCRS.
             */
            final Projection  projection = projected.getConversionFromBase();
            final ParameterValueGroup  p = projection.getParameterValues();
            assertEquals("Unexpected number of parameters.",            5,     p.values().size());
            assertEquals("grid_mapping_name", "lambert_conformal_conic",       p.parameter("grid_mapping_name").stringValue());
            assertEquals("latitude_of_projection_origin",              25.0,   p.parameter("latitude_of_projection_origin").doubleValue(), EPS);
            assertEquals("longitude_of_central_meridian",             -95.0,   p.parameter("longitude_of_central_meridian").doubleValue(), EPS);
            assertEquals("earth_radius",                          6371229.000, p.parameter("earth_radius").doubleValue(), EPS);
            assertArrayEquals("standard_parallel", new double[] {25.0, 25.05}, p.parameter("standard_parallel").doubleValueList(), EPS);
        }
    }
/**
     * Tests the compound CRS (<cite>projected</cite> + <cite>height</cite> + <cite>time</cite>)
     * declared in the {@link TestData#NETCDF_4D_PROJECTED} file.
     * This method tests the following conditions:
     *
     * <ul>
     *   <li>The {@linkplain #crs CRS} shall be an instance of {@link CompoundCRS}
     *       with 3 components: a {@link ProjectedCRS}, a {@link VerticalCRS} and
     *       a {@link TemporalCRS}.</li>
     *   <li>The axis directions shall be ({@link AxisDirection#EAST EAST},
     *       {@link AxisDirection#NORTH NORTH}, {@link AxisDirection#UP UP},
     *       {@link AxisDirection#FUTURE FUTURE}).</li>
     *   <li>The axis units shall be (<var>km</var>, <var>km</var>, <var>100 feet</var>, <var>seconds</var>).</li>
     *   <li>The {@linkplain TemporalDatum#getOrigin() temporal datum origin} shall be
     *       January 1st, 1970 at midnight UTC.</li>
     *   <li>The projection shall be a {@code "lambert_conformal_conic"}.</li>
     * </ul>
     *
     * @throws IOException if an error occurred while reading the test file.
     */
Tests the compound CRS (projected + height + time)
declared in the  TestData#NETCDF_4D_PROJECTED file.
This method tests the following conditions.



@throws IOException if an error occurred while reading the test file.
Tests the compound CRS ( projected + height + time ) declared in the TestData#NETCDF_4D_PROJECTED file . This method tests the following conditions . @throws IOException if an error occurred while reading the test file .
@Test
    public void testProjected4D() throws IOException {
        try (NetcdfDataset file = openDataset(TestData.NETCDF_4D_PROJECTED)) {
            final List<CoordinateSystem> crsList = file.getCoordinateSystems();
            assertEquals("Unexpected number of netCDF coordinate systems.", 1, crsList.size());
            crs = wrap(crsList.get(0), file);
            final ProjectedCRS projected = separateComponents("Expected a (projected + vertical + time) CRS.", ProjectedCRS.class, true);
            final CartesianCS cart = projected  .getCoordinateSystem();
            final VerticalCS  vert = verticalCRS.getCoordinateSystem();
            final TimeCS      time = temporalCRS.getCoordinateSystem();
            assertAxisDirectionsEqual("ProjectedCRS.cs", cart, EAST, NORTH);
            assertAxisDirectionsEqual("VerticalCRS.cs",  vert, UP);
            assertAxisDirectionsEqual("TemporalCRS.cs",  time, FUTURE);
            assertAxisEquals("x0",   Units.KILOMETRE,          cart.getAxis(0));
            assertAxisEquals("y0",   Units.KILOMETRE,          cart.getAxis(1));
            assertAxisEquals("z0",   Units.FOOT.multiply(100), vert.getAxis(0));
            assertAxisEquals("time", Units.SECOND,             time.getAxis(0));
            assertNameEquals("time z0 y0 x0", crs);
            assertEquals("Time since 1992-1-1 UTC", new Date(0L), temporalCRS.getDatum().getOrigin());
            /*
             * Following part is specific to ProjectedCRS.
             */
            final Projection  projection = projected.getConversionFromBase();
            final ParameterValueGroup  p = projection.getParameterValues();
            assertEquals("Unexpected number of parameters.",            5,     p.values().size());
            assertEquals("grid_mapping_name", "lambert_conformal_conic",       p.parameter("grid_mapping_name").stringValue());
            assertEquals("latitude_of_projection_origin",              25.0,   p.parameter("latitude_of_projection_origin").doubleValue(), EPS);
            assertEquals("longitude_of_central_meridian",             -95.0,   p.parameter("longitude_of_central_meridian").doubleValue(), EPS);
            assertEquals("earth_radius",                          6371229.000, p.parameter("earth_radius").doubleValue(), EPS);
            assertArrayEquals("standard_parallel", new double[] {25.0, 25.05}, p.parameter("standard_parallel").doubleValueList(), EPS);
        }
    }
@ Test public void testProjected4D ( ) throws IOException { try ( NetcdfDataset file = openDataset ( TestData . NETCDF_4D_PROJECTED ) ) { final List < CoordinateSystem > crsList = file . getCoordinateSystems ( ) ; assertEquals ( "Unexpected number of netCDF coordinate systems." , 1 , crsList . size ( ) ) ; crs = wrap ( crsList . get ( 0 ) , file ) ; final ProjectedCRS projected = separateComponents ( "Expected a (projected + vertical + time) CRS." , ProjectedCRS . class , true ) ; final CartesianCS cart = projected . getCoordinateSystem ( ) ; final VerticalCS vert = verticalCRS . getCoordinateSystem ( ) ; final TimeCS time = temporalCRS . getCoordinateSystem ( ) ; assertAxisDirectionsEqual ( "ProjectedCRS.cs" , cart , EAST , NORTH ) ; assertAxisDirectionsEqual ( "VerticalCRS.cs" , vert , UP ) ; assertAxisDirectionsEqual ( "TemporalCRS.cs" , time , FUTURE ) ; assertAxisEquals ( "x0" , Units . KILOMETRE , cart . getAxis ( 0 ) ) ; assertAxisEquals ( "y0" , Units . KILOMETRE , cart . getAxis ( 1 ) ) ; assertAxisEquals ( "z0" , Units . FOOT . multiply ( 100 ) , vert . getAxis ( 0 ) ) ; assertAxisEquals ( "time" , Units . SECOND , time . getAxis ( 0 ) ) ; assertNameEquals ( "time z0 y0 x0" , crs ) ; assertEquals ( "Time since 1992-1-1 UTC" , new Date ( 0L ) , temporalCRS . getDatum ( ) . getOrigin ( ) ) ; /*
             * Following part is specific to ProjectedCRS.
             */ final Projection projection = projected . getConversionFromBase ( ) ; final ParameterValueGroup p = projection . getParameterValues ( ) ; assertEquals ( "Unexpected number of parameters." , 5 , p . values ( ) . size ( ) ) ; assertEquals ( "grid_mapping_name" , "lambert_conformal_conic" , p . parameter ( "grid_mapping_name" ) . stringValue ( ) ) ; assertEquals ( "latitude_of_projection_origin" , 25.0 , p . parameter ( "latitude_of_projection_origin" ) . doubleValue ( ) , EPS ) ; assertEquals ( "longitude_of_central_meridian" , - 95.0 , p . parameter ( "longitude_of_central_meridian" ) . doubleValue ( ) , EPS ) ; assertEquals ( "earth_radius" , 6371229.000 , p . parameter ( "earth_radius" ) . doubleValue ( ) , EPS ) ; assertArrayEquals ( "standard_parallel" , new double [ ] { 25.0 , 25.05 } , p . parameter ( "standard_parallel" ) . doubleValueList ( ) , EPS ) ; } }
Tests the compound CRS (<cite>projected</cite> + <cite>height</cite> + <cite>time</cite>)
 declared in the {@link TestData#NETCDF_4D_PROJECTED} file.
Tests the compound CRS ( <cite > projected< / cite > + <cite > height< / cite > + <cite > time< / cite > ) declared in the { @link TestData#NETCDF_4D_PROJECTED } file .