Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#2264 closed defect (fixed)

t.rast.univar fails when r.univar fails

Reported by: martinl Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Temporal Version: svn-trunk
Keywords: t.rast.univar, r.univar Cc:
CPU: Unspecified Platform: Unspecified

Description

t.rast.univar fails when called r.univar prints no output

Traceback (most recent call last):
  File "/opt/src/grass_trunk/dist.x86_64-unknown-linux-gnu/scripts/t.rast.univar", line 67, in <module>
    main()
  File "/opt/src/grass_trunk/dist.x86_64-unknown-linux-gnu/scripts/t.rast.univar", line 63, in main
    "strds", input, where, extended, header, fs)
  File "/opt/src/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/temporal/univar_statistics.py", line 86, in print_gridded_dataset_univar_statistics
    string += fs + str(stats["mean"]) + fs + str(stats["min"])
KeyError: 'mean'

attachment:univar.diff prints a warning

WARNING: Unable to get statistics for raster map <terra_lst_day20020206@modis2002lst_1>

Actually commands fail when the map contains no data:

r.info terra_lst_day20020206
...
|   Range of data:    min = -nan  max = -nan                                 |
...

->

r.univar terra_lst_day20020206 --q

no output printed. It should fail or better to print 'nan' values.

Attachments (1)

univar.diff (777 bytes) - added by martinl 6 years ago.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by martinl

Attachment: univar.diff added

comment:1 in reply to:  description ; Changed 6 years ago by neteler

Replying to martinl:

r.univar terra_lst_day20020206 --q

no output printed. It should fail or better to print 'nan' values.

The issue is in r.univar, stats.c line 123. However, not that easy to fix since sometimes zones are consideres, sometimes not.

comment:2 Changed 6 years ago by martinl

Resolution: fixed
Status: newclosed

For the record, patch was included in r59916. So the original bug is fixed.

comment:3 in reply to:  1 Changed 6 years ago by neteler

Replying to neteler:

Replying to martinl:

r.univar terra_lst_day20020206 --q

no output printed. It should fail or better to print 'nan' values.

The issue is in r.univar, stats.c line 123. However, not that easy to fix since sometimes zones are consideres, sometimes not.

(r.univar issue continued in bug #2269)

comment:4 in reply to:  2 Changed 6 years ago by martinl

Replying to martinl:

For the record, patch was included in r59916. So the original bug is fixed.

Backported to relbr70 (as bugfix) in r 60019.

Note: See TracTickets for help on using tickets.