miniufo / xgrads

Parse and read ctl and associated binary file commonly used by GrADS into xarray
https://xgrads.readthedocs.io/
MIT License
71 stars 27 forks source link

can not support the 'mo' or 'yr' #3

Closed GithubWangYang closed 4 years ago

GithubWangYang commented 4 years ago

in my ctl file, the tdef unit is 'mo', when i run the script. throw a error like 'Cannot get a common metadata divisor for NumPy datetime metadata [s] and [M] because they have incompatible nonlinear base time units' the numpy's arange can not support month or year.

miniufo commented 4 years ago

Can you just paste all the ctl content here so I can get a quick fix?

GithubWangYang commented 4 years ago

dset c:\guangxi\files\emi\EMI_2019_monthly.grd byteswapped title CUACE_emi_index data undef -9999. pdef 360 320 lcc 35.00 103.50 180.50 160.50 30.00 60.00 103.50 15000. 15000. xdef 1220 linear 62.33 .0676 ydef 682 linear 11.18 .0676 zdef 1 levels 1 tdef 12 linear JAN2019 1mo vars 12 emi_index 0 99 pm u2/m3 demi_index 0 99 pm u2/m3 emisdep_index 0 99 pm u2/m3 diff_index 0 99 pm u2/m3 trans_index 0 99 pm u2/m3 trans_in 0 99 pm u2/m3 trans_out 0 99 pm u2/m3 surf_index 0 99 pm 1/1 semi_index 0 99 pm u2/m3 sdemi_index 0 99 pm u2/m3 emitest_index 0 99 pm u2/m3 deptest_index 0 99 pm u2/m3 endvars

GithubWangYang commented 4 years ago

thank you very much~~~

miniufo commented 4 years ago

Thank you for using the package and finding this bug. I've fixed it. So now you can parse your ctl correctly. Please tell me if it works fine in your case.

Another big problem is that the current version does not support PDEF, as in your case. I would love to enhance (see here #5) that but I do need some time. Would you please send me your associated binary data file if it is not too large? email: miniufo@163.com or qq: 176427777.