Opened 8 years ago

Closed 8 years ago

#1494 closed defect (fixed)

Rasql_Nilvalue (nodata) value missing from netCDF metadata and a overflow value for tiff nodata

Reported by: Bang Pham Huu Owned by: bbell
Priority: major Milestone: 9.4
Component: rasql Version: development
Keywords: rasql, nilValue, nodata Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description

so a encoding rasql with extra parameters containing nilValues and nodata like this

SELECT encode(c[0:0,211:211], "netCDF" , "{\"dimensions\":[\"i\",\"j\"],\"variables\":{\"i\":{\"type\":\"double\",\"data\":[0.5],\"name\":\"i\",\"metadata\":{\"standard_name\":\"i\",\"units\":\"GridSpacing\",\"axis\":\"X\"}},\"j\":{\"type\":\"double\",\"data\":[-0.5],\"name\":\"j\",\"metadata\":{\"standard_name\":\"j\",\"units\":\"GridSpacing\",\"axis\":\"Y\"}},\"value\":{\"type\":\"unsigned char\",\"name\":\"value\",\"metadata\":{\"units\":\"10^0\"}}},\"metadata\":{\"Project\":\"This is another test file\",\"Creator\":\"This is a test creator file\",\"Title\":\"This is a test file\"},\"nilValues\":[{\"value\":\"-9999999\"}],\"nodata\":[-9999999]}") FROM test_mr AS c

and the output file does not have the nilValues as show with

ncdump -c rasql_1.nc (you need to install ncdump first or install Panoply and open the output file)

// global attributes:
		:Creator = "This is a test creator file" ;
		:Project = "This is another test file" ;
		:Title = "This is a test file" ;

or with a real use case the value is shown as "missing_value = "NaNf ";

SELECT encode(c[0,1800:1800,0:0], "netCDF" , "{\"dimensions\":[\"Lat\",\"Long\"],\"variables\":{\"Lat\":{\"type\":\"double\",\"data\":[-89.95],\"name\":\"Lat\",\"metadata\":{\"standard_name\":\"latitude\",\"units\":\"degree_north\",\"axis\":\"Y\"}},\"Long\":{\"type\":\"double\",\"data\":[-179.95],\"name\":\"Long\",\"metadata\":{\"standard_name\":\"longitude\",\"units\":\"degree_east\",\"axis\":\"X\"}},\"ERAinterim discharge\":{\"type\":\"unsigned char\",\"name\":\"ERAinterim discharge\",\"metadata\":{\"missing_value\":[-9999],\"units\":\"10^0\"}}},\"geoReference\":{\"crs\":\"EPSG:4326\",\"bbox\":{\"xmin\":-180.00,\"ymin\":-89.90,\"xmax\":-180.00,\"ymax\":-89.90}},\"metadata\":{\"Title\":\"ERAinterim river discharge data\"},\"nilValues\":[{\"value\":\"-9999\"}],\"nodata\":[-9999]}") FROM test_reversed_lat_netcdf_netcdf AS c

If encoding to tiff file with big nodata value

SELECT encode(c[0:0,211:211], "tiff" , "{\"metadata\":{\"Project\":\"This is another test file\",\"Creator\":\"This is a test creator file\",\"Title\":\"This is a test file\"},\"nilValues\":[{\"value\":\"-9999999\"}],\"nodata\":[-9999999]}") FROM test_mr AS c

and check the metadata with gdalinfo rasql_1.tif, the NODATA_VALUES will overflow number in image's metadata

 NODATA_VALUES=-1e+07
  Project=This is another test file
  Title=This is a test file
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,    1.0)
Upper Right (    1.0,    0.0)
Lower Right (    1.0,    1.0)
Center      (    0.5,    0.5)
Band 1 Block=1x1 Type=Byte, ColorInterp=Gray
  NoData Value=-9999999

Change History (2)

comment:1 by Dimitar Misev, 8 years ago

In netcdf the nodata value should be put in the variable metadata:

"_FillValue" = 1.e+20f,
"missing_value" = 1.e+20f,

comment:2 by bbell, 8 years ago

Resolution: fixed
Status: newclosed

Patch applied.

Note: See TracTickets for help on using tickets.