fdetsch / MODIS

Download and processing framework for MODIS imagery. The package provides automated access to the global online data archives LP DAAC, LAADS and NSIDC as well as processing capabilities such as file conversion, mosaicking, subsetting and time series.
Other
58 stars 27 forks source link

Warnings when 'dataFormat = "netCDF"' #52

Open fdetsch opened 6 years ago

fdetsch commented 6 years ago

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.

MatMatt commented 6 years ago

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:

MagicForrest commented 6 years ago

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.