mantle-convection-constrained / terratools

Tools to read, analyse and visualise models written by the TERRA mantle convection code
https://terratools.readthedocs.io/en/latest/
MIT License
7 stars 5 forks source link

Conversion TERRA output to new standard #151

Closed FranckLatallerie closed 6 months ago

FranckLatallerie commented 6 months ago

Conversion fails for some TERRA outputs. This is probably due to having 'Depth' variable name starting with upper-case instead of lower-case in CDF files.

The error can be reproduced using simulation 107_scale or 106_scale. The conversion produces the following error:

VersionError: NetCDF file version '0.0' is not supported. Please convert with convert_files.convert

In [7]: convert_files.convert( tmfiles) ...:

IndexError Traceback (most recent call last) Cell In[7], line 1 ----> 1 convert_files.convert( tmfiles)

File /mnt/lustre/a2fs-work3/work/n03/n03/eart0587/pyvenv/lib/python3.9/site-packages/terratools/convert_files.py:47, in convert(files, test) 37 os.chmod( 38 file, 39 stat.S_IWUSR (...) 44 | stat.S_IROTH, 45 ) 46 data = nc4.Dataset(file, mode="a") ---> 47 depths = data["Depths"][:] 48 variables = ( 49 data.variables.copy() 50 ) # Copy so not overwriting dictionary keys in loop 51 for var in variables:

File src/netCDF4/_netCDF4.pyx:2517, in netCDF4._netCDF4.Dataset.getitem()

IndexError: Depths not found in /

jamespanton93 commented 6 months ago

Hi Franck, Did this get resolved or is this still an open issue?