t.rast.climatologies: new addon for GRASS 8#1005
t.rast.climatologies: new addon for GRASS 8#1005lucadelu wants to merge 9 commits intoOSGeo:grass8from
Conversation
Co-authored-by: Markus Neteler <neteler@osgeo.org>
Co-authored-by: Markus Neteler <neteler@osgeo.org>
a7111a1 to
87e03ad
Compare
|
Nice, works great. It would be good to also add a weekly granularity (or even user-defined ones). I added to questions/remarks. |
It could be but now I have no time to implement it, I suggest to merge it and later if you like to do that... ;-) |
|
@wenzeslaus I'm not sure I can write in grass8 branch... I have this |
I could certainly give it a try, at some time, bit busy right now :-). What about how the s-flag is described? As I wrote in a previous comment, it seems the description in the manual page doesn't clearly match what the flag is actually doing? Or am I just misreading it? |
|
|
||
| def main(): | ||
| import grass.pygrass.modules as pymod | ||
| import grass.script as gscript |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| import grass.script as gscript | |
| import grass.script as gs |
| import grass.script as gscript | ||
| import grass.temporal as tgis | ||
|
|
||
| options, flags = gscript.parser() |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| options, flags = gscript.parser() | |
| options, flags = gs.parser() |
|
|
||
| # check if quantile value is used correctly | ||
| if "quantile" in method and not quantile: | ||
| gscript.fatal(_("Number requested methods and output maps do not match.")) |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.fatal(_("Number requested methods and output maps do not match.")) | |
| gs.fatal(_("Number requested methods and output maps do not match.")) |
| gscript.warning( | ||
| _("Quantile option set but quantile not selected in method option") | ||
| ) |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.warning( | |
| _("Quantile option set but quantile not selected in method option") | |
| ) | |
| gs.warning(_("Quantile option set but quantile not selected in method option")) |
| if (len(list(filter(None, quantile.split(",")))) + len_method) != len( | ||
| output.split(",") | ||
| ): | ||
| gscript.fatal(_("Number requested methods and output maps do not match.")) |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.fatal(_("Number requested methods and output maps do not match.")) | |
| gs.fatal(_("Number requested methods and output maps do not match.")) |
| insp = tgis.open_old_stds(strds, "strds", dbif) | ||
| temporal_type, semantic_type, title, description = insp.get_initial_values() | ||
| if temporal_type != "absolute": | ||
| gscript.fatal( |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.fatal( | |
| gs.fatal( |
| ) | ||
| maps = insp.get_registered_maps_as_objects(None, "start_time", dbif) | ||
| if maps is None: | ||
| gscript.fatal( |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.fatal( | |
| gs.fatal( |
| outmaps.append(map_layer) | ||
|
|
||
| if doy % 10 == 0: | ||
| gscript.percent(doy, 366, 1) |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.percent(doy, 366, 1) | |
| gs.percent(doy, 366, 1) |
| ) | ||
| map_layer.set_temporal_extent(extent=extent) | ||
| outmaps.append(map_layer) | ||
| gscript.percent(month, 12, 1) |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.percent(month, 12, 1) | |
| gs.percent(month, 12, 1) |
| f"Climatologies created from {strds}, {gran} {method} maps", | ||
| semantic_type, | ||
| dbif, | ||
| gscript.overwrite(), |
There was a problem hiding this comment.
[ruff] reported by reviewdog 🐶
| gscript.overwrite(), | |
| gs.overwrite(), |

t.rast.climatologies is a module to calculate climatologies, i.e., long term stats, for single days or months in a time series.