[Gdal-dev] NetCDF CF-1 understood by GDAL?

Jeff Bullard jeffbullard at verizon.net
Sun Dec 3 09:40:02 EST 2006


I'm using gdal-1.3.2 to read NetCDF-3 CF-1 compliant files from NOAA
NDFD.  GDAL does not seem to pick up the coordinates or projection.
When I type
 
$gdal_translate NETCDF:"200612010300_sky.nc":Sky_SFC sky.tif

I get a TIFF that is upside-down and lacks lat/lon reference.  Unidata
NetCDF 2.2 tools (java) handles the same files without problem, picking
up the coordinates and projection automatically.  What argument can I
pass to gdal_translate to get a correct geotiff?

$ gdalinfo 200612010300_sky.nc
Driver: netCDF/Network Common Data Format
Size is 512, 512
Coordinate System is `'
Metadata:
  NC_GLOBAL#title=GRIB Data translated to NetCDF
  NC_GLOBAL#Conventions=CF-1.0
  NC_GLOBAL#CreatedBy=degrib
  NC_GLOBAL#comment=Used degrib with: -NetCDF 3
  NC_GLOBAL#references=http://www.nws.noaa.gov/mdl/NDFD_GRIB2Decoder/
Subdatasets:
  SUBDATASET_1_NAME=NETCDF:"200612010300_sky.nc":longitude
  SUBDATASET_1_DESC=[689x1073] longitude (32-bit floating-point)
  SUBDATASET_2_NAME=NETCDF:"200612010300_sky.nc":latitude
  SUBDATASET_2_DESC=[689x1073] latitude (32-bit floating-point)
  SUBDATASET_3_NAME=NETCDF:"200612010300_sky.nc":Sky_SFC
  SUBDATASET_3_DESC=[1x689x1073] Sky_SFC (32-bit floating-point)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)


$ ncdump -h 200612010300_sky.nc
netcdf 200612010300_sky {
dimensions:
        ProjectionHr = UNLIMITED ; // (1 currently)
        YCells = 689 ;
        XCells = 1073 ;
variables:
        char MapProjection ;
                MapProjection:long_name = "MapProjection" ;
                MapProjection:grid_mapping_name =
"lambert_conformal_conic" ;
                MapProjection:EarthShape = "sphere" ;
                MapProjection:EarthRadius_KM = 6371.2 ;
                MapProjection:EarthRadius = "6371.200000 km" ;
                MapProjection:standard_parallel = 25. ;
                MapProjection:longitude_of_central_meridian = -95. ;
                MapProjection:latitude_of_projection_origin = 25. ;
                MapProjection:LowerLeftLatitude = 20.191999 ;
                MapProjection:LowerLeftLongitude = -121.554001 ;
        double YCells(YCells) ;
                YCells:units = "m" ;
                YCells:long_name = "y coordinate of projection" ;
                YCells:standard_name = "projection_y_coordinate" ;
                YCells:grid_spacing = "5079.406000 m" ;
                YCells:TrueGridLength_Latitude = 25. ;
                YCells:_CoordinateAxisType = "GeoY" ;
        double XCells(XCells) ;
                XCells:units = "m" ;
                XCells:long_name = "x coordinate of projection" ;
                XCells:standard_name = "projection_x_coordinate" ;
                XCells:grid_spacing = "5079.406000 m" ;
                XCells:TrueGridLength_Latitude = 25. ;
                XCells:_CoordinateAxisType = "GeoX" ;
        float longitude(YCells, XCells) ;
                longitude:long_name = "longitude coordinate" ;
                longitude:units = "degrees_east" ;
                longitude:precision = 6 ;
                longitude:grid_mapping = "MapProjection" ;
                longitude:standard_name = "longitude" ;
                longitude:_CoordinateAxisType = "Lon" ;
        float latitude(YCells, XCells) ;
                latitude:long_name = "latitude coordinate" ;
                latitude:units = "degrees_north" ;
                latitude:precision = 6 ;
                latitude:grid_mapping = "MapProjection" ;
                latitude:standard_name = "latitude" ;
                latitude:_CoordinateAxisType = "Lat" ;
        float Sky_SFC(ProjectionHr, YCells, XCells) ;
                Sky_SFC:long_name = "Total cloud cover" ;
                Sky_SFC:units = "%" ;
                Sky_SFC:coordinates = "longitude latitude" ;
                Sky_SFC:ReferenceTime = 1164931200 ;
                Sky_SFC:ReferenceTimeString = "2006-12-01 00:00:00
00:00" ;
                Sky_SFC:gridType = "SCALAR" ;
                Sky_SFC:level = "SFC" ;
                Sky_SFC:DescriptiveLevel = "0[-] SFC=\"Ground or water
surface\"" ;
                Sky_SFC:OriginatingCenter = 8, 65535 ;
                Sky_SFC:precision = 0 ;
                Sky_SFC:valid_min = 0.f ;
                Sky_SFC:valid_max = 100.f ;
                Sky_SFC:NumMissing = 375560 ;
                Sky_SFC:_FillValue = 9999.f ;
                Sky_SFC:missing_value = 9999.f ;
                Sky_SFC:grid_mapping = "MapProjection" ;
                Sky_SFC:GRIBMessageVersion = 2 ;
                Sky_SFC:GRIBMessageUnits = "%" ;
                Sky_SFC:GRIB2_Discipline = 0 ;
                Sky_SFC:GRIB2_Sect4TemplateNumber = 0 ;
                Sky_SFC:GRIB2_Sect4ParameterCategory = 6 ;
                Sky_SFC:GRIB2_Sect4ParameterNumber = 1 ;
                Sky_SFC:GRIB2_GenerationProcess = 2 ;
                Sky_SFC:GRIB2_FstFixedSurfaceType = 1 ;
                Sky_SFC:GRIB2_FstFixedSurfaceValue = 0. ;
                Sky_SFC:GRIB2_SndFixedSurfaceType = 255 ;
                Sky_SFC:GRIB2_SndFixedSurfaceValue = 0. ;
        short ProjectionHr(ProjectionHr) ;
                ProjectionHr:long_name = "Projection Hour After
ReferenceTime" ;
                ProjectionHr:units = "hours since 2006-12-01 00:00:00
00:00" ;
                ProjectionHr:_CoordinateAxisType = "Time" ;
                ProjectionHr:FirstValidTime = 1164942000 ;
                ProjectionHr:FirstValidTimeString = "2006-12-01 03:00:00
00:00" ;
                ProjectionHr:FirstProjectionHR = 3. ;

// global attributes:
                :title = "GRIB Data translated to NetCDF" ;
                :Conventions = "CF-1.0" ;
                :CreatedBy = "degrib" ;
                :comment = "Used degrib with: -NetCDF 3" ;
                :references =
"http://www.nws.noaa.gov/mdl/NDFD_GRIB2Decoder/" ;
}





More information about the Gdal-dev mailing list