Skip to content

Conversation

@lucadelu
Copy link
Contributor

@lucadelu lucadelu commented Dec 30, 2023

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

@lucadelu lucadelu requested a review from wenzeslaus December 30, 2023 07:15
@neteler neteler changed the title added t.rast.climatologies for GRASS 8 t.rast.climatologies: new addon for GRASS 8 Dec 30, 2023
@neteler neteler added the new addon PR contains a new addon or issue proposes one label Dec 30, 2023
@lucadelu lucadelu force-pushed the t.rast.climatologies.v8 branch from a7111a1 to 87e03ad Compare January 13, 2024 06:16
@ecodiv
Copy link
Contributor

ecodiv commented Jan 15, 2024

Nice, works great. It would be good to also add a weekly granularity (or even user-defined ones). I added to questions/remarks.

@lucadelu
Copy link
Contributor Author

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... ;-)

@lucadelu
Copy link
Contributor Author

@wenzeslaus I'm not sure I can write in grass8 branch... I have this

Screenshot from 2024-01-16 06-04-34

@ecodiv
Copy link
Contributor

ecodiv commented Jan 16, 2024

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... ;-)

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
import grass.script as gscript
import grass.script as gs

import grass.script as gscript
import grass.temporal as tgis

options, flags = gscript.parser()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
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."))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
gscript.fatal(_("Number requested methods and output maps do not match."))
gs.fatal(_("Number requested methods and output maps do not match."))

Comment on lines +109 to +111
gscript.warning(
_("Quantile option set but quantile not selected in method option")
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
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."))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
gscript.fatal(
gs.fatal(

)
maps = insp.get_registered_maps_as_objects(None, "start_time", dbif)
if maps is None:
gscript.fatal(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
gscript.fatal(
gs.fatal(

outmaps.append(map_layer)

if doy % 10 == 0:
gscript.percent(doy, 366, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
gscript.percent(month, 12, 1)
gs.percent(month, 12, 1)

f"Climatologies created from {strds}, {gran} {method} maps",
semantic_type,
dbif,
gscript.overwrite(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
gscript.overwrite(),
gs.overwrite(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new addon PR contains a new addon or issue proposes one

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants