Skip to content

Conversation

@lucadelu
Copy link
Contributor

@lucadelu lucadelu commented Jan 5, 2024

This surpasses the previous #1003

@neteler neteler added new addon PR contains a new addon or issue proposes one Python Related code is in Python labels Jan 5, 2024
….html

Co-authored-by: Markus Neteler <neteler@osgeo.org>
@ecodiv
Copy link
Contributor

ecodiv commented Jan 15, 2024

Would it be an option to add the choice between meteorological and astronomical seasons?

@ecodiv
Copy link
Contributor

ecodiv commented Jan 15, 2024

The following works nicely as advertised.

t.rast.aggregate.seasons input=precs years=2005,2006,2007 basename=seasons1 method=average

If I also define the output, I get an empty stdrs (i.e., no actual raster layers are created)

t.rast.aggregate.seasons input=precs years=2005,2006,2007 basename=seasons2 output=precaggr2  method=average

@lucadelu
Copy link
Contributor Author

Would it be an option to add the choice between meteorological and astronomical seasons?

Done in 56abd70

@lucadelu
Copy link
Contributor Author

The following works nicely as advertised.

t.rast.aggregate.seasons input=precs years=2005,2006,2007 basename=seasons1 method=average

If I also define the output, I get an empty stdrs (i.e., no actual raster layers are created)

t.rast.aggregate.seasons input=precs years=2005,2006,2007 basename=seasons2 output=precaggr2  method=average

This is strange, there are tests to check this and it seems to work properly, could you please run the test in your environment?

@ecodiv
Copy link
Contributor

ecodiv commented Jan 16, 2024

The following works nicely as advertised.

t.rast.aggregate.seasons input=precs years=2005,2006,2007 basename=seasons1 method=average

If I also define the output, I get an empty stdrs (i.e., no actual raster layers are created)

t.rast.aggregate.seasons input=precs years=2005,2006,2007 basename=seasons2 output=precaggr2  method=average

This is strange, there are tests to check this and it seems to work properly, could you please run the test in your environment?

I'll try, but later this week. I am not sure how you run those tests, though. Just a matter of running the Python code in those test files?

@ecodiv
Copy link
Contributor

ecodiv commented Jan 16, 2024

Would it be an option to add the choice between meteorological and astronomical seasons?

Done in 56abd70

Super.. and on the change that I am over-asking, would it be an idea to let the user define their own seasons? If you think so, but have no time, I can give it a try adding it (at some time).

@ecodiv
Copy link
Contributor

ecodiv commented Jan 20, 2024

This is strange, there are tests to check this and it seems to work properly, could you please run the test in your environment?

@lucadelu I wasn't sure how to run the test, so I just created a new location following the code in the test file and ran the rest of the code manually. All works, except the last step from the test file:

Module(
    "t.rast.aggregate.seasons",
    input="monthly",
    output="meteo_seasons",
    basename="meteoseasons",
    overwrite=True,
    verbose=True,
    flags=["m"],
)

Runs without error, and results in the new strds meteo_seasons. Now, if I run:

t.rast.list input=meteo_seasons@PERMANENT

I get the following error message:

ERROR: Nothing found in the database for space time dataset
<meteo_seasons2@PERMANENT> (type: strds): Dataset is empty

So the same problem I reported earlier.

if strds.find("@") >= 0:
id_ = strds
else:
id_ = f'{strds}@{gs.gisenv()["MAPSET"]}'
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
id_ = f'{strds}@{gs.gisenv()["MAPSET"]}'
id_ = f"{strds}@{gs.gisenv()['MAPSET']}"

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 Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants