org.opengis.wrapper.netcdf
Class IOTestCase

Show UML class diagram
Object
  extended by IOTestCase
Direct Known Subclasses:
NetcdfCRSTest, NetcdfMetadataTest

public abstract class IOTestCase
extends Object

Base class of NetCDF test cases performing I/O operations. This base class provides an open(String) method for creating NetcdfFile objects from the build-in test files.

Since:
3.1

Field Summary
static String CIP
          The "CIP.nc" test file (HDF5 binary format).
static String LANDSAT
          The "Landsat-GDAL.nc" test file (NetCDF classic binary format).
static String NCEP
          The "NCEP-SST.nc" test file (NetCDF classic binary format).
static String THREDDS
          The "THREDDS.ncml" test file (XML format).
 
Constructor Summary
protected IOTestCase()
          For subclass constructors only.
 
Method Summary
protected  NetcdfFile open(String file)
          Opens the given NetCDF file.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREDDS

public static final String THREDDS
The "THREDDS.ncml" test file (XML format). This test uses a file derived from the NetCDF Attribute Convention for Dataset Discovery page on October 5, 2011. The main parts of this file are as below:
<netcdf>
  <!-- Metadata from the NetCDF or NcML file global attributes -->
  <attribute name="Conventions" value="CF-1.4"/>
  <attribute name="title" value="crm_v1.grd"/>
  <attribute name="history" value="xyz2grd -R-80/-64/40/48 -I3c -Gcrm_v1.grd"/>
  <attribute name="GMT_version" value="4.5.1 [64-bit]"/>
  <attribute name="creator_name" value="David Neufeld"/>
  <attribute name="creator_email" value="xxxxx.xxxxxxx@noaa.gov"/>
  <attribute name="geospatial_lon_units" value="degrees_east"/>
  <attribute name="geospatial_lat_units" value="degrees_north"/>
  <attribute name="geospatial_lon_min" type="float" value="-80.0"/>
  <attribute name="geospatial_lon_max" type="float" value="-64.0"/>
  <attribute name="geospatial_lat_max" type="float" value="48.0"/>
  <attribute name="geospatial_lat_min" type="float" value="40.0"/>
  <attribute name="geospatial_lon_resolution" type="double" value="8.33E-4"/>
  <attribute name="geospatial_lat_resolution" type="double" value="8.33E-4"/>

  <dimension name="x" length="19201"/>
  <dimension name="y" length="9601"/>

  <variable name="z" shape="y x" type="float">
    <attribute name="long_name" value="z"/>
    <attribute name="_FillValue" type="float" value="NaN"/>
    <attribute name="actual_range" type="double" value="-2754.39990234375 1903.0"/>
    <attribute name="units" value="meters"/>
    <attribute name="positive" value="up"/>
  </variable>
  <variable name="x" shape="x" type="double">
    <attribute name="long_name" value="x"/>
    <attribute name="actual_range" type="double" value="-80.0 -64.0"/>
    <attribute name="units" value="degrees_east"/>
    <attribute name="_CoordinateAxisType" value="Lon"/>
  </variable>
  <variable name="y" shape="y" type="double">
    <attribute name="long_name" value="y"/>
    <attribute name="actual_range" type="double" value="40.0 48.0"/>
    <attribute name="units" value="degrees_north"/>
    <attribute name="_CoordinateAxisType" value="Lat"/>
  </variable>
</netcdf>
Some additional THREDDS attributes are defined but not tested by this module. The full file can be seen from the source code repository.

The Coordinate Reference System of this dataset is geographic.

See Also:
NetcdfMetadataTest.testTHREDDS(), NetcdfCRSTest.testGeographic(), Constant Field Values

NCEP

public static final String NCEP
The "NCEP-SST.nc" test file (NetCDF classic binary format). This file was downloaded from the examples provided in the NetCDF Attribute Convention for Dataset Discovery page on October 5, 2011. The global attributes are listed below. Note that this particular NetCDF file specifies the geographic bounding box ordinates as string values rather than numerical values. Consequently the implementations to be tested need to perform conversions.
:record = "reftime, valtime" ;
:history = "2003-04-07 12:12:50 - created by gribtocdl 2005-09-26T21:50:00 - edavis - add attributes for dataset discovery" ;
:title = "Sea Surface Temperature Analysis Model" ;
:Conventions = "NUWG, _Coordinates" ;
:GRIB_reference = "Office Note 388 GRIB" ;
:GRIB_URL = "http://www.nco.ncep.noaa.gov/pmb/docs/on388/" ;
:version = 1. ;
:Metadata_Conventions = "Unidata Dataset Discovery v1.0" ;
:summary = "NCEP SST Global 5.0 x 2.5 degree model data" ;
:keywords = "EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature" ;
:keywords_vocabulary = "GCMD Science Keywords" ;
:id = "NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc" ;
:naming_authority = "edu.ucar.unidata" ;
:cdm_data_type = "Grid" ;
:date_created = "2005-09-22T00:00" ;
:creator_name = "NOAA/NWS/NCEP" ;
:creator_url = "" ;
:creator_email = "" ;
:geospatial_lat_min = "-90.0" ;
:geospatial_lat_max = "90.0" ;
:geospatial_lon_min = "-180.0" ;
:geospatial_lon_max = "180.0" ;
:geospatial_vertical_min = "0.0" ;
:geospatial_vertical_max = "0.0" ;
:time_coverage_start = "2005-09-22T00:00" ;
:time_coverage_duration = "0.0" ;
:license = "Freely available" ;
The Coordinate Reference System of this dataset is compound (geographic + (temporal). The values are Sea Surface Temperature (SST).

See Also:
NetcdfMetadataTest.testNCEP(), NetcdfCRSTest.testGeographic_XYT(), Constant Field Values

CIP

public static final String CIP
The "CIP.nc" test file (HDF5 binary format). Some attributes are listed below:
variables:
    int grid_mapping_0 ;
        grid_mapping_0:grid_mapping_name = "lambert_conformal_conic" ;
        grid_mapping_0:longitude_of_central_meridian = -95.f ;
        grid_mapping_0:latitude_of_projection_origin = 25.f ;
        grid_mapping_0:standard_parallel = 25.f, 25.05f ;
    float CIP(time, z0, y0, x0) ;
        CIP:long_name = "Current Icing Product " ;
        CIP:valid_min = 0.f ;
        CIP:valid_max = 0.44f ;
        CIP:units = "%" ;
        CIP:grid_mapping = "grid_mapping_0" ;
The Coordinate Reference System of this dataset is compound (geographic + (temporal).

See Also:
NetcdfMetadataTest.testCIP(), NetcdfCRSTest.testProjected_XYZT(), Constant Field Values

LANDSAT

public static final String LANDSAT
The "Landsat-GDAL.nc" test file (NetCDF classic binary format). This is a freely available Landsat test file converted to NetCDF by GDAL. The main attributes are listed below:
char lambert_conformal_conic ;
    lambert_conformal_conic:Northernmost_Northing = -4218968.14605944 ;
    lambert_conformal_conic:Southernmost_Northing = -4221948.66130479 ;
    lambert_conformal_conic:Easternmost_Easting = 1060889.92068945 ;
    lambert_conformal_conic:Westernmost_Easting = 1054928.89019874 ;
    lambert_conformal_conic:GeoTransform = "1054928.890198743 30.10621459950866 0 -4218968.146059438 0 -30.10621459950866 " ;
    lambert_conformal_conic:grid_mapping_name = "lambert_conformal_conic" ;
    lambert_conformal_conic:standard_parallel_1 = -18.f ;
    lambert_conformal_conic:standard_parallel_2 = -36.f ;
    lambert_conformal_conic:latitude_of_projection_origin = 0.f ;
    lambert_conformal_conic:longitude_of_central_meridian = 134.f ;
    lambert_conformal_conic:false_easting = 0.f ;
    lambert_conformal_conic:false_northing = 0.f ;
byte Band1(y, x) ;
    Band1:grid_mapping = "lambert_conformal_conic" ;
    Band1:long_name = "GDAL Band Number 1" ;

:Conventions = "CF-1.0" ;
:AREA_OR_POINT = "Area" ;
The Coordinate Reference System of this dataset is projected.

See Also:
NetcdfMetadataTest.testLandsat(), Constant Field Values
Constructor Detail

IOTestCase

protected IOTestCase()
For subclass constructors only.

Method Detail

open

protected NetcdfFile open(String file)
                   throws IOException
Opens the given NetCDF file. This method process as below: For example if an implementor extends this class in his "com.mycompany" package and provides a "THREDDS.ncml" file in that package, then his test file will have precedence over the geoapi-netcdf build-in test file.

Parameters:
file - The file name, typically one of the THREDDS or NCEP constants.
Returns:
The NetCDF file.
Throws:
IOException - If an error occurred while opening the file.
TODO:
Use "try with resources" when we will be allowed to compile for JDK7.


Copyright © 1994-2013 Open Geospatial Consortium. All Rights Reserved.