Hi!
It seem to work fine with this patch. Should I make a ticket?
Index: frmts/netcdf/netcdfdataset.cpp
===================================================================
--- frmts/netcdf/netcdfdataset.cpp (revision 24746)
+++ frmts/netcdf/netcdfdataset.cpp (working copy)
@@ -2603,14 +2603,14 @@
const char *pszUnitsX = NULL;
const char *pszUnitsY = NULL;
- strcpy( szTemp, "x" );
+ strcpy( szTemp, poDS->papszDimName[nXDimID] );
strcat( szTemp, "#units" );
pszValue = CSLFetchNameValue( poDS->papszMetadata,
szTemp );
if( pszValue != NULL )
pszUnitsX = pszValue;
- strcpy( szTemp, "y" );
+ strcpy( szTemp, poDS->papszDimName[nYDimID] );
strcat( szTemp, "#units" );
pszValue = CSLFetchNameValue( poDS->papszMetadata,
szTemp );
GDAL_netCDF:
=====
calling nc_open(
osisaf-nh_aggregated_ice_concentration_nh_polstere-100_200712010000.nc )
GDAL_netCDF: got cdfid=65536
GDAL_netCDF: driver detected file type=1, libnetcdf detected type=1
GDAL_netCDF: dim_count = 4
GDAL_netCDF: var_count = 26
GDAL_netCDF: variable #2 [time_bounds] was ignored
GDAL_netCDF: variable #6 [lon] was ignored
GDAL_netCDF: variable #7 [lat] was ignored
GDAL_netCDF:
=====
SetProjectionFromVar( 10 )
GDAL_netCDF: got grid_mapping Polar_Stereographic_Grid
GDAL_netCDF: bIsGdalFile=0 bIsGdalCfFile=0 bBottomUp=1
GDAL_netCDF: set bBottomUp = 0 from Y axis
GDAL_netCDF: setting WKT from CF
GDAL_netCDF: SetProjection, WKT = PROJCS["unnamed",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",70],PARAMETER["central_meridian",-45],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1000,AUTHORITY["EPSG","9001"]]]
GDAL_netCDF:
SetGeoTransform(-3855.005000,10.000000,0.000000,5844.997000,0.000000,-10.000000)
GDAL_netCDF: using variables lon and lat for GEOLOCATION
GDAL_netCDF: bGotGeogCS=0 bGotCfSRS=1 bGotCfGT=1 bGotGdalSRS=0 bGotGdalGT=0
GDAL:
GDALOpen(NETCDF:osisaf-nh_aggregated_ice_concentration_nh_polstere-100_200712010000.nc:ice_conc_avg,
this=0x1924f30) succeeds as netCDF.
Driver: netCDF/Network Common Data Format
GDAL: GDALDefaultOverviews::OverviewScan()
Files:
osisaf-nh_aggregated_ice_concentration_nh_polstere-100_200712010000.nc
Size is 760, 1120
Coordinate System is:
PROJCS["unnamed",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4326"]],
PROJECTION["Polar_Stereographic"],
PARAMETER["latitude_of_origin",70],
PARAMETER["central_meridian",-45],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1000,
AUTHORITY["EPSG","9001"]]]
Origin = (-3855.005000000000109,5844.997000000000298)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
ice_conc_avg#_FillValue=-1e+10
ice_conc_avg#cell_methods=time: mean
ice_conc_avg#comment=as far as possible, interpolated values from input
files are avoided
ice_conc_avg#coordinates=lon lat
ice_conc_avg#grid_mapping=Polar_Stereographic_Grid
ice_conc_avg#long_name=averaged total ice concentration
ice_conc_avg#units=%
ice_conc_avg#valid_max=100
ice_conc_avg#valid_min=0
NC_GLOBAL#abstract=Monthly sea ice concentration estimated from satellite
data
within the framework of EUMETSAT Ocean and Sea Ice SAF.
NC_GLOBAL#activity_type=Space borne instrument
NC_GLOBAL#area=Northern Hemisphere
NC_GLOBAL#comment=For the OSI SAF daily product the Northern hemisphere
polar observation hole and other missing sectors are filled using
interpolation. If possible, the averaged monthly sea ice concentration is
based on nominal and corrected values only, avoiding the interpolated
values.
NC_GLOBAL#contact=osisaf-...@met.no
NC_GLOBAL#Conventions=CF-1.0
NC_GLOBAL#distribution_statement=Free
NC_GLOBAL#easternmost_longitude=180
NC_GLOBAL#gcmd_keywords=Cryosphere > Sea Ice > Sea Ice Concentration
Oceans > Sea Ice > Sea Ice Concentration
Cryosphere > Sea Ice > Sea Ice Extent
Oceans > Sea Ice > Sea Ice Extent
Cryosphere > Sea Ice > Sea Ice Edge
Oceans > Sea Ice > Sea Ice Edge
Geographical Region > Northern Hemisphere
Vertical Location > Sea Surface
NO/MET > Norwegian Meteorological Institute, Norway
NC_GLOBAL#history=2010-04-26 creation
NC_GLOBAL#institution=Norwegian Meteorological Institute
NC_GLOBAL#keywords=Monthly Sea Ice Concentration,Monthly Sea Ice
Extent,Sea Ice,Oceanography,Meteorology,Climate,Remote Sensing
NC_GLOBAL#northernmost_latitude=90
NC_GLOBAL#PI_name=OSISAF HL Manager
NC_GLOBAL#product_name=EUMETSAT OSISAF sea ice
NC_GLOBAL#product_status=under development
NC_GLOBAL#project_name=CryoClim
NC_GLOBAL#projection=stere
NC_GLOBAL#resolution=10.00 km
NC_GLOBAL#source=EUMETSAT OSISAF ice concentration product
NC_GLOBAL#southernmost_latitude=31.039446
NC_GLOBAL#start_date=2007-12-01 00:00:00 UTC
NC_GLOBAL#stop_date=2008-01-01 00:00:00 UTC
NC_GLOBAL#title=Monthly aggregated sea ice concentration product
NC_GLOBAL#topiccategory=Oceans ClimatologyMeteorologyAtmosphere
NC_GLOBAL#url=http://saf.met.no/, http://cryoclim.met.no/metamod/sch/
NC_GLOBAL#westernmost_longitude=-180
NETCDF_DIM_EXTRA={time}
NETCDF_DIM_time_DEF={1,6}
NETCDF_DIM_time_VALUES=944006400
Polar_Stereographic_Grid#earth_shape=elliptical
Polar_Stereographic_Grid#false_easting=0
Polar_Stereographic_Grid#false_northing=0
Polar_Stereographic_Grid#grid_mapping_name=polar_stereographic
Polar_Stereographic_Grid#latitude_of_projection_origin=90
Polar_Stereographic_Grid#proj4_string=+proj=stere +a=6378273
+b=6356889.44891 +lat_0=90 +lat_ts=70 +lon_0=-45
Polar_Stereographic_Grid#standard_parallel=70
Polar_Stereographic_Grid#straight_vertical_longitude_from_pole=-45
time#axis=T
time#bounds=time_bounds
time#comment=The time variable contains the start date of the averaging
period.
time#long_name=reference time of product
time#standard_name=time
time#units=seconds since 1978-01-01 00:00:00
xc#axis=X
xc#grid_spacing=10.00 km
xc#long_name=x coordinate of projection (eastings)
xc#standard_name=projection_x_coordinate
xc#units=km
yc#axis=Y
yc#grid_spacing=10.00 km
yc#long_name=y coordinate of projection (northings)
yc#standard_name=projection_y_coordinate
yc#units=km
Geolocation:
LINE_OFFSET=0
LINE_STEP=1
PIXEL_OFFSET=0
PIXEL_STEP=1
SRS=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]
X_BAND=1
X_DATASET=NETCDF:"osisaf-nh_aggregated_ice_concentration_nh_polstere-100_200712010000.nc":lon
Y_BAND=1
Y_DATASET=NETCDF:"osisaf-nh_aggregated_ice_concentration_nh_polstere-100_200712010000.nc":lat
OGRCT: Source: +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0
+y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=km +no_defs
OGRCT: Target: +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
Corner Coordinates:
Upper Left ( -3855.005, 5844.997) (168d24'23.11"E, 30d59'22.39"N)
Lower Left ( -3855.005, -5355.003) ( 80d44'58.84"W, 33d52'24.04"N)
Upper Right ( 3744.995, 5844.997) (102d21' 5.69"E, 31d24'47.25"N)
Lower Right ( 3744.995, -5355.003) ( 10d 1'59.42"W, 34d20' 7.54"N)
Center ( -55.005, 244.997) (147d39'13.75"E, 87d40'56.52"N)
Band 1 Block=760x1 Type=Float32, ColorInterp=Undefined
NoData Value=-10000000000
Metadata:
_FillValue=-1e+10
cell_methods=time: mean
comment=as far as possible, interpolated values from input files are
avoided
coordinates=lon lat
grid_mapping=Polar_Stereographic_Grid
long_name=averaged total ice concentration
NETCDF_DIM_time=944006400
NETCDF_VARNAME=ice_conc_avg
units=%
valid_max=100
valid_min=0
GDAL:
GDALClose(NETCDF:osisaf-nh_aggregated_ice_concentration_nh_polstere-100_200712010000.nc:ice_conc_avg,
this=0x1924f30)
On 08/07/2012 01:38 PM, Etienne Tourigny wrote:
Hi,
km units are supposed to work...
Here is the code where "km" units are detected, which set the WKT
units to 1000m.
/* add units to PROJCS */
if ( pszUnits != NULL && ! EQUAL(pszUnits,"") ) {
if ( EQUAL(pszUnits,"m") ) {
oSRS.SetLinearUnits( CF_UNITS_M, 1.0 );
oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9001 );
}
else if ( EQUAL(pszUnits,"km") ) {
oSRS.SetLinearUnits( CF_UNITS_M, 1000.0 );
oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9001 );
}
What does the wkt actually look like?
Also running gdalinfo --debug ON <file.nc> can give a few hints.
It would be good for you to send me a link to the file or attach it to
a bug report (add me as cc).
Etienne
On Tue, Aug 7, 2012 at 6:10 AM, Anton Korosov <anton.koro...@nersc.no>
wrote:
Dear Etienne,
I faced the following problem with the NetCDF driver:
Units of the dimension variables are 'km' and values in the SRS are in
meters, of course (e.g. Earth radius). Hence the calculated GeoTransform
is
1000 times less than should be and the calculate latlons are incorrect.
However 'units' attribute is given, besides AFAIK CF-conventions allow to
have 'k' (kilo) preceding 'm' (meters) in the units.
Can you please give me a hint where to fix that in the driver so that it
can
adequately interpret units of the dimensions?
With best regards!
Anton
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev