MODIS icon indicating copy to clipboard operation
MODIS copied to clipboard

Warnings when 'dataFormat = "netCDF"'

Open fdetsch opened this issue 7 years ago • 2 comments

As indicated by @MagicForrest in #39, trying to write .nc output files, for example

lai_ref = runGdal("MCD15A2H", tileH = 21, tileV = 8
                  , begin = "2003001", end = "2003008"
                  , maskValue = 249:254, SDSstring = "010000", job = "mcd15a2h"
                  , dataFormat = "netCDF", overwrite = TRUE)

, throws the following (GDAL related) warnings:

Warning 6: driver netCDF does not support creation option compress Warning 6: driver netCDF does not support creation option predictor Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Warning 6: driver netCDF does not support creation option compress Warning 6: driver netCDF does not support creation option predictor Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF!

. The compression parameters

> cp
[1] " -co compress=lzw -co predictor=2"

passed to gdalwarp are apparently not valid. Moreover, the netCDF write driver doesn't seem to recognize the target spatial reference system

> t_srs
[1] " -t_srs \"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs\""

. Using an 'outProj' other than default 'asIn', for example

lai_ref = runGdal("MCD15A2H", tileH = 21, tileV = 8
                  , begin = "2003001", end = "2003008"
                  , maskValue = 249:254, SDSstring = "010000", job = "mcd15a2h"
                  , dataFormat = "netCDF", outProj = "+init=epsg:4326", overwrite = TRUE)

, leads to subsequent defects likely resulting from the non-recognized Sinusoidal projection:

Warning 6: driver netCDF does not support creation option compress Warning 6: driver netCDF does not support creation option predictor Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Error in rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[, : no arguments in initialization list

We must be aware of the fact that this might apply to other write drivers in a similar fashion.

fdetsch avatar Aug 01 '18 15:08 fdetsch

What about putting compress=lzw and predictor=2 into .MODISopts.R?

The projection issue is not clear to me: Warning 1: projection name Sinusoidal in not part of the CF standard, will not be supported by CF! Error in rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[, : no arguments in initialization list How can we specify Sinusoidal for the output then? Is it a matter of reformatting the argument string? i.e. sinusoidal instead of Sinusoidal. I am not sure but check here: The WRITE_LONLAT=IF_NEEDED option is useful in the case of exporting a projection which is not supported by the CF-1.5 standard (e.g. sinusoidal), so any CF-1.5 compliant software can locate the points on a lon/lat map.

In CF-1.7 it should be supported, see here:

MatMatt avatar Aug 01 '18 15:08 MatMatt

Hi, thanks for picking this up! Since it has been reproduced and is GDAL-related there is not much I can do to help at the moment (I am not particularly good with GDAL). But if there is, just let me know, especially if you want linux testing etc.

MagicForrest avatar Aug 03 '18 12:08 MagicForrest