[MITgcm-support] rdmds & error

Mahdi Mohammadi mahdiaragh at yahoo.com
Wed Nov 6 06:57:20 EST 2024


Hi,
 After several years I am updating my scripts using MITgcmutils. Unfortunately, I receive the following errors. I am unsure if these errors are relevant to my grids files, my python3, or ...
I would be grateful if anybody could advise me.
Best, Mahdi

In [4]: XC= MT.rdmds('/media/mahdi/D/IR24/data/grids/XC')
   ...: 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/miniconda3/envs/mysos/lib/python3.10/site-packages/MITgcmutils-0.1.0-py3.10.egg/MITgcmutils/mds.py:67, in parse1(s)
     66 try:
---> 67     return int(s)
     68 except ValueError:

ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

ParseError                                Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 XC= MT.rdmds('/media/mahdi/D/IR24/data/grids/XC')

File ~/miniconda3/envs/mysos/lib/python3.10/site-packages/MITgcmutils-0.1.0-py3.10.egg/MITgcmutils/mds.py:337, in rdmds(fnamearg, itrs, machineformat, rec, fill_value, returnmeta, astype, region, lev, usememmap, mm, squeeze, verbose)
    334 if debug: warning('Found',len(metafiles),'metafiles for iteration',it)
    336 for metafile in metafiles:
--> 337     gdims,i0s,ies,timestep,timeinterval,map2gl,meta = readmeta(metafile)
    338     if arr is None:
    339         # initialize, allocate
    340         try:

File ~/miniconda3/envs/mysos/lib/python3.10/site-packages/MITgcmutils-0.1.0-py3.10.egg/MITgcmutils/mds.py:175, in readmeta(f)
    173 def readmeta(f):
    174     """ read meta file and extract tile/timestep-specific parameters """
--> 175     meta = parsemeta(f)
    176     dimList = meta.pop('dimList')
    177     # pythonize

File ~/miniconda3/envs/mysos/lib/python3.10/site-packages/MITgcmutils-0.1.0-py3.10.egg/MITgcmutils/mds.py:126, in parsemeta(metafile)
    122 _currentline = line
    124 if opening == '[':
    125     # [] can contain any type of values, separated by commas
--> 126     val = [ parse1(s) for s in re.split(r',? *',line) ]
    127 else:
    128     # {} can only contain single quote-delimited strings separated by space
    129     val = [ s.rstrip() for s in re.split(r"'  *'", line.strip("'")) ]

File ~/miniconda3/envs/mysos/lib/python3.10/site-packages/MITgcmutils-0.1.0-py3.10.egg/MITgcmutils/mds.py:126, in <listcomp>(.0)
    122 _currentline = line
    124 if opening == '[':
    125     # [] can contain any type of values, separated by commas
--> 126     val = [ parse1(s) for s in re.split(r',? *',line) ]
    127 else:
    128     # {} can only contain single quote-delimited strings separated by space
    129     val = [ s.rstrip() for s in re.split(r"'  *'", line.strip("'")) ]

File ~/miniconda3/envs/mysos/lib/python3.10/site-packages/MITgcmutils-0.1.0-py3.10.egg/MITgcmutils/mds.py:69, in parse1(s)
     67     return int(s)
     68 except ValueError:
---> 69     raise ParseError("Cannot parse value: " + s)

ParseError: in metafile: Cannot parse value: 
in: 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20241106/931a5aa6/attachment.html>


More information about the MITgcm-support mailing list