pyet-org / pyet

:sunflower: pyet is a Python package to estimate reference and potential evaporation.
https://pyet.readthedocs.io/
MIT License
130 stars 33 forks source link

Remove 'shape' as argument from 'extraterrestrial_r' method in meter_utils.py #64

Closed raoulcollenteur closed 9 months ago

raoulcollenteur commented 11 months ago

Looks like this is a useless argument that could and should be inferred from the data. So I propose to remove it from the argument list.

mvremec commented 9 months ago

Is implemented with 1.3

rodaguayo commented 5 months ago

When I upgraded from v1.2.2 to 1.3.1, my code stopped working (I use dataarrays). There seems to be some sort of latitude issue

mvremec commented 5 months ago

Hi @rodaguayo,

Thank you for posting this issue! Could you please provide a bit more detail about what you mean by "code stopped working"? Are all of the methods affected, or only specific ones?

I noticed you're working with the Patagonia dataset—glad to see that PyEt has been helpful there!

I will do my best to solve this issue today.

Best, Matevz

rodaguayo commented 5 months ago

Hi, thanks for the quick reply!

My workflow is very simple, similar to this tutorial (https://pyet.readthedocs.io/en/latest/examples/09_CMIP6_data.html), with the exception I am using the hargreaves formulation. The error that I recieved is operands could not be broadcast together with shapes because the latitude array only has one dimension. This error was not present in version 1.2.2

Thanks for your time, and for the very helpful package you have developed =)

Best, Rodrigo

mvremec commented 5 months ago

HI @rodaguayo, Thanks again for bringing this to our attention. It seems we removed the code that allowed latitude to be either a 1D or 2D array during our last update. As of version 1.3.1, latitude must be a 2D array, with dimensions matching those of the tmean array (typically latitude/longitude or x/y coordinates).

A quick fix for now is to expand the dimension of the latitude array using: lat = lat.expand_dims(dim='new_dim', axis=1)

I'll fix this in the upcoming pull request and also add a test to ensure PyEt properly handles both 1D and 2D latitude arrays in future releases. #78

Let me know if this solves your issue.

rodaguayo commented 4 months ago

Hi @mvremec,

Thanks for this. I imagine something like this could have happened. Thanks again for your efforts in maintaining ansd developing this helpful package.

Best, Rodrigo