miniufo / xgrads

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

Error while open ctl with %f2.dat #25

Closed janer0 closed 3 years ago

janer0 commented 3 years ago

the ctl file is begin with dset ^Z_NAFP_C_BABJ_2019071512_PCAMS-CPEFS-ASEC%f2.dat

open ctl error

File "", line 1, in ctl = CtlDescriptor(file='F:/CPEFS/Z_NAFP_C_BABJ_2019071512_P_CAMS-CPEFS-ASEC.ctl')

File "c:\programdata\anaconda3\lib\site-packages\xgrads\core.py", line 137, in init self.parse(fileContent)

File "c:\programdata\anaconda3\lib\site-packages\xgrads\core.py", line 181, in parse self._processDSets(dpath_str)

File "c:\programdata\anaconda3\lib\site-packages\xgrads\core.py", line 205, in _processDSets tokens.append(self._get_template_format(token))

File "c:\programdata\anaconda3\lib\site-packages\xgrads\core.py", line 525, in _get_template_format raise Exception('unsupported format: ' + part)

Exception: unsupported format: %f2

miniufo commented 3 years ago

Could you please provide me a sample dataset and ctl file so that I can find a solution?

miniufo commented 3 years ago

I received your sample data with name Z_NAFP_C_BABJ_2019071512_P_CAMS-CPEFS-ASEC_00. The last 00 corresponds to %f2. Could you provides more file names? I expect to be 06, 12, 18... Template in ctl means a single ctl describing more than one data files. I need to know the rules of the file names.

janer0 commented 3 years ago

the 00 means t=0, and the next is 01,02...48, refer to tdef 49 in ctl file

miniufo commented 3 years ago

Actually, I've updated the code to support %f2. See here and you may check if you are using the newest codes.

janer0 commented 3 years ago

yes, this code works. seems pip install is not the newest codes

miniufo commented 3 years ago

Ops I forgot to update that...