[GRASS-dev] more interesting failure for reading fp_range of a NULL map

Hi,

dealing with large amount of maps, some of them process to NULL on all pixels.

when accessing fp_range in cell_misc, the file is empty, thus returning such an error:

WARNING: Unable to read fp range file for NULL_map_test@PERMANENT

While I understand this is undefined because of all pixels being NULL,

would it be possible to have a more interesting output?

This could help in screening NULL maps too…

Thank you,

Yann

Yann Chemin

Researcher@IWMI

Skype/FB: yann.chemin

Yann Chemin wrote:

dealing with large amount of maps, some of them process to NULL on all
pixels.
when accessing fp_range in cell_misc, the file is empty, thus returning
such an error:

WARNING: Unable to read fp range file for <NULL_map_test@PERMANENT>

While I understand this is undefined because of all pixels being NULL,
would it be possible to have a more interesting output?

lib/raster/range.c is inconsistent in this regard. When writing an FP
range, it writes an empty file if the range is null:

    /* if range hasn't been updated, write empty file meaning Nulls */

When reading an empty f_range file, it generates the above warning
(the FPRange structure is initialised with min and max both null).

It would be a simple matter to change the warning (e.g. "range is
null") or remove it. A warning might be useful, as I can imagine
modules failing in interesting ways if an input map is all-null.

--
Glynn Clements <glynn@gclements.plus.com>

On 6 March 2013 23:35, Glynn Clements <glynn@gclements.plus.com> wrote:

Yann Chemin wrote:

> dealing with large amount of maps, some of them process to NULL on all
> pixels.
> when accessing fp_range in cell_misc, the file is empty, thus returning
> such an error:
>
> WARNING: Unable to read fp range file for <NULL_map_test@PERMANENT>
>
> While I understand this is undefined because of all pixels being NULL,
> would it be possible to have a more interesting output?

lib/raster/range.c is inconsistent in this regard. When writing an FP
range, it writes an empty file if the range is null:

    /* if range hasn't been updated, write empty file meaning Nulls */

When reading an empty f_range file, it generates the above warning
(the FPRange structure is initialised with min and max both null).

It would be a simple matter to change the warning (e.g. "range is
null") or remove it. A warning might be useful, as I can imagine
modules failing in interesting ways if an input map is all-null.

In the same way as there is a pixel based function to assess a NULL pixel
value,
it would be very interesting to have a function to test an all NULL raster
map status.

Time series analysis would be the first to benefit.

--
Glynn Clements <glynn@gclements.plus.com>

--
Yann Chemin
Researcher@IWMI
Skype/FB: yann.chemin