grass icon indicating copy to clipboard operation
grass copied to clipboard

temporal: dont fail when registering maps with missing range file

Open ninsbl opened this issue 3 years ago • 4 comments

If maps are linked to the GRASS GIS database with r.external -r those maps do not have a range file. When trying to register them in a STRDS, the process fails because no map info is returned at all, meaning no north, south, ... info either. In consequence, NON-NULL constraints of the TGIS DB are violated.

This PR fixes the inconsistency, so I tagged it as a bug and added a backport label. If others feel different about it, please feel free to change the labels.

In case of a missing range file, now None/NULL is returned as range of map values together with a valid spatial extent.

ninsbl avatar May 19 '22 13:05 ninsbl

The failing OSGeo4W test is unrelated. If there are no objections, I will merge and backport next week...

ninsbl avatar Jun 17 '22 21:06 ninsbl

Why exactly do you want to support r.external -r for TGIS? A missing or empty range file can cause all sorts of problems with other modules. Particularly with temporal modules, often calling other modules for actual raster processing, error messages eventually caused by an empty range file might be difficult to interpret.

metzm avatar Jul 01 '22 16:07 metzm

Why exactly do you want to support r.external -r for TGIS?

When using GDALs /vsicurl/ to link online raster data resources, even the -m flag for just reading metadata causes the the dataset to be read entirely if metadata is missing. For larger datasets that is a) time consuming and b) (almost) the same as downloading the whole thing. I use r.external -r for NetCDF files on Thredds servers, but that can be equally releveant for COGs or the like if metadata is missing...

For the addon I have been working on (https://github.com/ninsbl/t.rast.import.netcdf) I may be able to create a range file from a known "valid range" of the data. Could that be helpful to avoid processing errors down the road?

A missing or empty range file can cause all sorts of problems with other modules. Particularly with temporal modules, often calling other modules for actual raster processing, error messages eventually caused by an empty range file might be difficult to interpret.

Is there somewhere documentation which kinds of modules require a range file? My usecase is having a set of linked data in a time series to spatio-temporal select from it for further processing. Do e.g. r.mapcalc, r.series, r.univar have problems when a range file is missing? I can imagine that r.colors can run into issues...

Maybe with a warning, we can allow people to risk shooting themselfs in the foot also here, as r.external -r probably does anyway?

ninsbl avatar Aug 04 '22 08:08 ninsbl

...even the -m flag for just reading metadata causes the the dataset to be read entirely if metadata is missing...

See #2381 for some tests and analysis.

wenzeslaus avatar Aug 04 '22 13:08 wenzeslaus

Backported in bf0c12f and ecb6c22

ninsbl avatar Sep 08 '22 22:09 ninsbl