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

PDEF not supported. #12

Closed beingchayan closed 2 years ago

beingchayan commented 4 years ago

I am trying to open a few .ctl files through your wonderful xgrads module, but they do not open because of the following error.

Traceback (most recent call last):
  File "C:\Users\acer\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-7ffba5019cbb>", line 2, in <module>
    dset = open_mfdataset(a[0])
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\io.py", line 64, in open_mfdataset
    datasets = [open_(p, encoding=encoding) for p in paths]
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\io.py", line 64, in <listcomp>
    datasets = [open_(p, encoding=encoding) for p in paths]
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\io.py", line 102, in open_CtlDataset
    ctl = CtlDescriptor(encoding=encoding, file=desfile)
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\core.py", line 137, in __init__
    self.parse(fileContent)
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\core.py", line 159, in parse
    self._processPDEF(oneline)
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\core.py", line 241, in _processPDEF
    self.pdef = PDEF(oneline)
  File "C:\Users\acer\Anaconda3\lib\site-packages\xgrads\core.py", line 675, in __init__
    raise Exception('not currently supported PDEF\n' + oneline)
Exception: not currently supported PDEF
PDEF 182 149 general 4 stream binary ^pdefs/tos_CMCC.CMCC-CMS_r1i1p1_0p5.pdef
miniufo commented 4 years ago

Thanks for your interest in xgrads. Right now only two kinds of PDF is supported: one is SPS or NPS (polar stereographic projection), the other is LCCR or LCC (Lambert conformal conic projection). I would like to add support to more projections. Is it possible to provide me a small piece of data (and the content of ctl file) as the test data so that I can give a try?

raghu330 commented 3 years ago

Thanks for your interest in xgrads. Right now only two kinds of PDF is supported: one is SPS or NPS (polar stereographic projection), the other is LCCR or LCC (Lambert conformal conic projection). I would like to add support to more projections. Is it possible to provide me a small piece of data (and the content of ctl file) as the test data so that I can give a try?

Dear Qian, Can you also let pdef be undefined or say projection is 'latlon' for regularly gridded files?? I can share a sample data file (grd) with you. Let me know how you want this to be shared either by git, kaggle, ftp, dropbox or simple email???? -Raghu

miniufo commented 3 years ago

I see your post here #28, and I will reply to that issue.