gicait / PyAEZ

PyAEZ is a python package consisted of many algorithms related to Agro-ecalogical zoning (AEZ) framework.
MIT License
74 stars 51 forks source link

some problems in module NB2_CropSimulation #87

Open yelvk opened 10 months ago

yelvk commented 10 months ago

I need to seek help from you. why my result gotten in NB2 is none. its like 1693759436701 in the last step it returned :zero-size array to reduction operation maximum which has no identity and in the step to read LGP result it returned :/pyaez/CropSimulation.py:493: RuntimeWarning: invalid value encountered in divide lgp_whole = xx[:365]/yy[:365],i know this means zero aprears in calculation,maybe whats preblem in ,but NB1's result is not zero ,i dont know how to solve it

NokuzaSezo97 commented 10 months ago

Hi @yelvk,

From your error report, I suspect there zero-division cases happening during LGP calculation from Module II; this doesn't happen in Module I because error raising due to this case is ignored. However, I would like to check more. So I would require from you:

  1. NB2 you use for Module II,
  2. Climate data, auxiliary datasets (in numpy arrays) and crop parameter file as excel sheet.
  3. The package version list of numpy, numba, scipy, gdal, pandas, and python.

Also from your side, please do these checks:

  1. Check whether climate data have nan values, if exist, please substitute with zero.

For immediate solving, since you didn't encounter error in Module I, and if the result doesn't look fishy. You can use the output directly into Module II, and try running the crop simulation again.

Best regards,

Swun Wunna Htet

yelvk commented 10 months ago

thank you for the quick answer。 today i listen to your advice ,checked my climate data ,substitute .npy file's nan value to zero.but unfortunately ,it seems not any changes happened. do mask raster and other raster data out of alignment cause this problem? there are my NB1 and NB2 notebooks link https://colab.research.google.com/drive/1sQL-PXw3s4-U2eW4jELAWHNHrv6U7-Du?usp=sharing https://colab.research.google.com/drive/174z56EoKl1gn1FrhNrpViMaq6B_xYCau?usp=sharing
and there's my google drive workdir link https://drive.google.com/drive/folders/16U4OAcB2Y2fTsPzA_qW_GLXaZXn6fToH?usp=sharing the packages i directly import in colab ,and the parameter i used the xlsx download from gihub ,while select the maize_35

kboonma commented 10 months ago

@yelvk I have added few lines to the CropSimulaton.py file to prevent this 'RuntimeWarning: invalid value encountered in divide' error.

maobw12 commented 5 months ago

May I ask if you have solved this problem? I also had this problem and it has not yet been resolved

NokuzaSezo97 commented 5 months ago

#

@yelvk I have added few lines to the CropSimulaton.py file to prevent this 'RuntimeWarning: invalid value encountered in divide' error.

We've fixed this LGP code part causing zero errors, LGP should work now. Please test it out.

Regards,

Swun Wunna Htet

maobw12 commented 5 months ago

我在 CropSimulaton.py 文件中添加了几行,以防止出现“RuntimeWarning:除法中遇到无效值”错误。

我们已经修复了导致零错误的 LGP 代码部分,LGP 现在应该可以工作了。请测试一下。

问候

Swun Wunna Htet(斯温·乌纳·赫特特酒店)

I used the LGP calculation from module 1, and the result is still zero.