Replies: 2 comments
-
Thank you for your suggestions! @CharlesZheZhang @tslin2 Could you please take a look at this issue and see if we can update our old scripts based on what this user suggested here? Let's have a separate internal discussion if needed. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello, thank you very much for the suggestions, really appreciated @MEZY03 . I wrote the python script based on a pre-existing perl script for NLDAS - that's where the century and year variables come from, and it could use some updates as suggested in this discussion. Actually, some issues have already been addressed in this PR #96. It is currently in the develop branch and will go into the master branch in the next release cycle. I remember there is also a shell script provided in the develop branch to extract ERA5-Land data, which could be faster too. We can have a quick follow-up discussion on this later on @cenlinhe @tslin2 to see which one we want to use. Best, |
Beta Was this translation helpful? Give feedback.
-
Hello, recently I use ERA5-Land making forcing data, but found that *. py codes in hrldas/HRLDAS_forcing/run/examples/ERA5 has many problems:
The indentation format of the code is inconsistent, some are TAB and some are space, resulting in an error of "inconsistent use of tabs and spaces in indentation"
The "nums" variable has no effect
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L13
Why are centuries separated from years? They could have been written together
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L20
This is a very serious mistake, only seven numbers 92, 94, 00, 04, 08, 12, 16 are not enough to judge a flat leap year
Moreover, the condition in the if statement is wrong, and the correct way to write it is "if (yrs[yy] == "92" or yrs[yy] == "96")" rather than "if (yrs[yy] == "92" or "96")", which results in any year could be judged as a leap year
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L40
The print statement requires parentheses in python3
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L72
extract_era5_init.py and calculate_Q_era5.py don't automatically create INIT and Q directory
To solve the above problems, I made changes one by one, and integrated all the time and path settings into common.py, see ERA5_extract_v1.zip
In addition, I found the code for time handling to be quite complex. In fact, python has the "datetime" library makes it easy to handle time formats without loop. For this, I simplified the code further, see ERA5_extract_v2.zip
I wonder if these issues can be fixed in the future update, thank you @CharlesZheZhang #96
ERA5_extract_v1.zip
ERA5_extract_v2.zip
你好,最近我使用ERA5-Land制作驱动数据,但是发现hrldas/HRLDAS_forcing/run/examples/ERA5下面的*.py代码有许多问题:
代码的缩进格式不统一,有的是TAB缩进,有的是空格缩进,导致出现“inconsistent use of tabs and spaces in indentation”错误
nums变量没有任何作用
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L13
为什么世纪要和年份分开?它们完全可以写在一起
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L20
这是一个很严重的错误,仅凭七个数92、94、00、04、08、12、16不足以判断平闰年
而且if语句里的条件是错的,正确写法是if (yrs[yy] == "92" or yrs[yy] == "96")而不是if (yrs[yy] == "92" or "96"),后者会导致任意的年份都会被判断为闰年
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L40
print语句在python3版本中需要加括号
https://github.com/NCAR/hrldas/blob/master/hrldas/HRLDAS_forcing/run/examples/ERA5/extract_era5.py#L72
extract_era5_init.py和calculate_Q_era5.py没法自动创建INIT和Q文件夹
针对上述问题,我逐一进行了修改,并将所有时间和路径的设置整合到了common.py中,见ERA5_extract_v1.zip
此外,我还发现时间处理的代码十分复杂,事实上python有datetime库可以便捷地处理时间格式,不需要循环遍历数组。对此,我对代码进行了进一步简化,见ERA5_extract_v2.zip
不知道未来的更新中可不可以修复这些问题,谢谢
Beta Was this translation helpful? Give feedback.
All reactions