[Gdal-dev] matching metadata for different file formats
Matt Fearon
matt at guero.sr.unh.edu
Fri Jun 29 14:30:18 EDT 2007
Hi All,
Wondering if anyone could give me some advice on the following. Sjur was
helping me, but has gone on holiday.
I have a grib file that I have converted to a netcdf. My goal is to
reproject the data in the netcdf file from polar stereographic to
geographic. The original grib file reprojects nicely using the following
GDAL command;
gdalwarp -t_srs '+proj=latlong +datum=WGS84' gag4.19980201.01 out_geo.tif
However, the netcdf file does not reproject correctly. I believe it is
due to metadata being lost. The only difference between the 2 files are
the format, metadata, and the data values - after some calculations on
the data. The coordinate system, projection, and datum etc.. are the
same. How can I make the metadata consistent between the 2 files using
GDAL commands and reproject accurately? I have tried many things
unsuccessfully. Please see below the following:
1. gdalinfo on grib file
2. gdalinfo on netcdf file before gdal_translate
3. gdalinfo on geotiff after gdal_translate (an attempt to make metadata
consistent)
Help would be greatly appreciated.
thanks,
Matt
---- gdalinfo on grib file:
Driver: GRIB/GRIdded Binary (.grb)
Files: gag4.19980201.01
Size is 1160, 880
Coordinate System is:
PROJCS["unnamed",
GEOGCS["Coordinate System imported from GRIB file",
DATUM["unknown",
SPHEROID["Sphere",6371200,0]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Polar_Stereographic"],
PARAMETER["latitude_of_origin",60],
PARAMETER["central_meridian",255],
PARAMETER["scale_factor",90],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0]]
Origin = (-2095445.938568701269105,-3433257.108374913223088)
Pixel Size = (4763.000000000000000,-4763.000000000000000)
Corner Coordinates:
Upper Left (-2095445.939,-3433257.108) (136d23'50.23"W, 52d37'0.31"N)
Lower Left (-2095445.939,-7624697.108) (120d22'0.66"W, 22d44'35.90"N)
Upper Right ( 3429634.061,-3433257.108) ( 60d 1'48.89"W, 45d35'28.48"N)
Lower Right ( 3429634.061,-7624697.108) ( 80d46'53.41"W, 19d46'5.69"N)
Center ( 667094.061,-5528977.108) ( 98d 7'13.01"W, 39d48'1.57"N)
Band 1 Block=1160x1 Type=Float64, ColorInterp=Undefined
Description = 0[-] SFC (Ground or water surface)
---- gdalinfo on netcdf before gdal_translate. Note metadata on the
coordinate system, datum, projection, and corners have been lost when
compared to grib.
Driver: netCDF/Network Common Data Format
Files: 19980201.nc
Size is 1160, 880
Coordinate System is `'
Metadata:
precip#_FillValue=-9.990000e+02
precip#description=These daily data are a sum of the original hourly
data; the sum used a GMT to UTC time adjustment (15 deg change longitude
= 1 hour change in GMT); the adjustment was calculated per individual
gridcell determining the linear distance between centroid longitude and
the prime meridian
precip#date=19980201
precip#longname=Daily Precipitation
precip#shortname=precip
precip#center=US National Weather Service - NCEP (WMC)
precip#long_name=Total precipitation
precip#units=kg/m2
precip#coordinates=gridlat_240 gridlon_240
precip#level_indicator=1
precip#gds_grid_type=5
precip#parameter_table_version=2
precip#parameter_number=61
precip#model=WSR-88D Stage II Precipitation Analysis
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 880.0)
Upper Right ( 1160.0, 0.0)
Lower Right ( 1160.0, 880.0)
Center ( 580.0, 440.0)
Band 1 Block=1160x1 Type=Float32, ColorInterp=Undefined
NoData Value=-999
Metadata:
NETCDF_VARNAME=precip
---- gdalinfo on geotiff after the following gdal_translate command.
Note how GEOGCS says "unnamed ellipse" and Spheroid says "unnamed".
These are different when compared to the grib. Grib has these as
"sphere". How can I change these to "sphere" and keep the radii =
6371200 km ?
gdal_translate -sds -a_srs '+proj=stere +lat_ts=60 +lat_0=90 +lon_0=255
+k_0=90 +x_0=0 +y_0=0 +a=6371200 +b=6371200' -a_ullr -2095445.939
-3433257.108 3429634.061 -7624697.108 19980201.nc 19980201.tif
Files: 19980201.tif
Size is 1160, 880
Coordinate System is:
PROJCS["unnamed",
GEOGCS["unnamed ellipse",
DATUM["unknown",
SPHEROID["unnamed",6371200,0]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Polar_Stereographic"],
PARAMETER["latitude_of_origin",60],
PARAMETER["central_meridian",255],
PARAMETER["scale_factor",90],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (-2095445.939000000013039,-3433257.108000000007451)
Pixel Size = (4763.000000000000000,-4763.000000000000000)
Metadata:
AREA_OR_POINT=Area
precip#_FillValue=-9.990000e+02
precip#description=These daily data are a sum of the original hourly
data; the sum used a GMT to UTC time adjustment (15 deg change longitude
= 1 hour change in GMT); the adjustment was calculated per individual
gridcell determining the linear distance between centroid longitude and
the prime meridian
precip#date=19980201
precip#longname=Daily Precipitation
precip#shortname=precip
precip#center=US National Weather Service - NCEP (WMC)
precip#long_name=Total precipitation
precip#units=kg/m2
precip#coordinates=gridlat_240 gridlon_240
precip#level_indicator=1
precip#gds_grid_type=5
precip#parameter_table_version=2
precip#parameter_number=61
precip#model=WSR-88D Stage II Precipitation Analysis
Corner Coordinates:
Upper Left (-2095445.939,-3433257.108) (136d23'50.23"W, 52d37'0.31"N)
Lower Left (-2095445.939,-7624697.108) (120d22'0.66"W, 22d44'35.90"N)
Upper Right ( 3429634.061,-3433257.108) ( 60d 1'48.89"W, 45d35'28.48"N)
Lower Right ( 3429634.061,-7624697.108) ( 80d46'53.41"W, 19d46'5.69"N)
Center ( 667094.061,-5528977.108) ( 98d 7'13.01"W, 39d48'1.57"N)
Band 1 Block=1160x1 Type=Float32, ColorInterp=Gray
NoData Value=-999
Metadata:
NETCDF_VARNAME=precip
More information about the Gdal-dev
mailing list