Opened 11 years ago

Closed 11 years ago

Last modified 11 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 11 years ago.

Download all attachments as: .zip

Change History (5)

by martinl, 11 years ago

Attachment: univar.diff added

in reply to:  description ; comment:1 by neteler, 11 years ago

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 by martinl, 11 years ago

Resolution: fixed
Status: newclosed

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

in reply to:  1 comment:3 by neteler, 11 years ago

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)

in reply to:  2 comment:4 by martinl, 11 years ago

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.