-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invalid L-moments SPEI #441
Comments
Thanks @mabelcalim Can you please post a link to your input datasets? This will allow me to attempt to reproduce and debug the error. |
@mabelcalim can you please try again with the latest code from the master branch? There were changes made recently which may have fixed your issue. |
I also experiencing the same error: invalid L-moments. Btw how to install the latest code from master branch? Currently I use UPDATE
Data: https://drive.google.com/file/d/1GaVFVux2rH1fUNh9w6u6SRUun-Rs9a_i/view?usp=sharing |
Hi James and Benny,
This issue was solved by reevaluating the shape of the input time series.
Check if the prec, temp have the same shape and format of
evapotransp (from Thornthwaite PET script) and the time dimension is
monotonically ascendent.
…_____________________________________
*Mabel Calim Costa*
*GitHub*: https://github.com/mabelcalim
ORCID: https://orcid.org/0000-0003-3787-3983
*Lattes:* http://lattes.cnpq.br/3002998002368589
On Fri, 5 Nov 2021 at 06:52, Benny Istanto ***@***.***> wrote:
@mabelcalim <https://github.com/mabelcalim> can you please try again with
the latest code from the master branch? There were changes made recently
which may have fixed your issue.
I also experiencing the same error: invalid L-moments. Btw how to install
the latest code from master branch? Currently I use pip install
climate-indices
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRW6DJ2CIFG6UMPG2BTBCLUKOSN7ANCNFSM5C4IC5EA>
.
|
Hi Mabel, thank you for the hint. I have check both data and its correct, above example is for SPI calculation and I also try the SPEI too and got the same error. |
I have updated the version in PyPI to 1.0.10, @bennyistanto please try installing this new version, please report if you are still having issues. |
Thank you James! I have tested to calculate SPEI and it's worked. But strange that the SPI calculation remain failed with same error UPDATE |
Hi James, For this case I used:
As a background:
Unfortunately, 7 out of 32 tiles are failed in the calculation process (highlighted orange below). I have try in both Mac mini and Jupyter server, and failed. |
@bennyistanto I apologize in advance it may take me a while to look into and resolve this issue. Have you used the latest version from the master branch? I will soon make an upload to PyPI with the latest version which may fix this for you (there were good fixes added for the PE3 distribution fitting which is perhaps relevant here, although I think those changes are already in the version on PyPI, I should verify that). |
Yes, I used the latest version 1.0.10. Thanks you @monocongo looking forward to the update. |
Hi, I just re-installed anaconda with python 3.9, the climate-indices 1.0.10, etc. The error: [10:16:16 marcelozeri]$ spi --periodicity monthly --scales 1 --netcdf_precip chirps-v2.0.monthly_BR2.nc --output_file_base SPIs --var_name_precip precip --calibration_start_year 1981 --calibration_end_year 2011 --multiprocessing all_but_one Update after this: |
Hi @monocongo, @bennyistanto , I also ran into this issue while generating SPEI using TerraClimate, with a Pearson distribution. I've been able to isolate and reproduce the issue using some specific cells within TerraClimate. It appears to be in cells that either have a high count of zero pET or all zero pET. The error varies depending on the scale used (1 vs 3 month SPEI). I've written a notebook that shows the working here: https://github.com/peterataylor/climate_indices/blob/master/notebooks/SPEI_pearson_lmoment_bug_example.ipynb. I show the issue and then demonstrate you can remove the issue by filling with a distribution of low pET values for the zeros. Also show how this case affects 1-month but not 3-month SPEI. Not sure of the ultimate fix in terms of adjustments to the l-moment calculation, but this should provide a test case. |
I am also running into an L-moment related error. The example case for SPI works as expected but when I attempt an SPI calculation on a different file, I get the following error:
The same line works just fine if I use the example code and have tested it with a similarly short duration reference period. I have also taken the dataset and modified the dims to match that of the example. Below is the header for the file:
I should note that I modified main.py to convert m/s to mm from the monthly input file. |
I'm using the PyPi version of climate indices. I'm getting this " Unable to calculate Pearson Type III parameters due to invalid L-moments" trying to submit SPEI and SPI calculation .
Describe the bug
ValueError: Unable to calculate Pearson Type III parameters due to invalid L-moments
To Reproduce
This is my code:
process_climate_indices --index spei --periodicity monthly --netcdf_precip /Users/calim/code/CEMADEN/data/prec_pant_axis_new_latpet_ascend.nc --var_name_precip precip --netcdf_pet /Users/calim/code/CEMADEN/data/PET_thornthwaite_ascend.nc --var_name_pet pet_thornthwaite --output_file_base /Users/calim/code/CEMADEN/data/nclimgrid_lowres --scales 6 12 --calibration_start_year 1981 --calibration_end_year 2021 --multiprocessing all
Error:
2021-08-26 17:55:33 INFO Start time: 2021-08-26 17:55:33.291960
2021-08-26 17:55:33 INFO Computing monthly SPI
2021-08-26 17:55:33 INFO Computing 1-month SPI (Gamma)
2021-08-26 17:55:53 INFO Computing 1-month SPI (Pearson)
2021-08-26 17:56:04 ERROR Unable to calculate Pearson Type III parameters due to invalid L-moments
2021-08-26 17:56:04 ERROR Unable to calculate Pearson Type III parameters due to invalid L-moments
2021-08-26 17:56:04 ERROR Unable to calculate Pearson Type III parameters due to invalid L-moments
2021-08-26 17:56:04 ERROR Unable to calculate Pearson Type III parameters due to invalid L-moments
2021-08-26 17:56:04 ERROR Failed to complete
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 768, in get
raise self._value
ValueError: Unable to calculate Pearson Type III parameters due to invalid L-moments
prec_pant_axis_new_latpet_ascend.nc - lat and lon values in ascending order, shape(lat,lon,time) = (33, 41, 487)
PET_thornthwaite_ascend.nc - get from climate-indices PET- also lat and lon values in ascending order, shape(lat,lon,time) = (33, 41, 487)
Files from Pantanal (Brasil) region from 1981-2021.
Expected behavior
SPEI netcdf files
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
I'm using the PyPi version of climate-indices==1.0.9
The text was updated successfully, but these errors were encountered: