MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
39 stars 65 forks source link

Crash while running ocean_add_depth #389

Closed sterlingbaldwin closed 3 years ago

sterlingbaldwin commented 3 years ago

I think there's an inverted if statement causing an issue in the ocean_add_depth script. Specifically I think this should read if coordFileName is None: and not if coordFileName is not None:

>> ocean_add_depth -i mpaso.hist.am.timeSeriesStatsMonthly.2015-01-01.nc -o mpaso.hist.am.timeSeriesStatsMonthly.2015-01-01_withDepth.nc
Traceback (most recent call last):
  File "/export/baldwin32/anaconda3/envs/pflow3/bin/ocean_add_depth", line 11, in <module>
    sys.exit(main_add_depth())
  File "/export/baldwin32/anaconda3/envs/pflow3/lib/python3.8/site-packages/mpas_tools/ocean/depth.py", line 174, in main_add_depth
    add_depth(args.inFileName, args.outFileName,
  File "/export/baldwin32/anaconda3/envs/pflow3/lib/python3.8/site-packages/mpas_tools/ocean/depth.py", line 121, in add_depth
    dsCoord = xarray.open_dataset(coordFileName, mask_and_scale=False)
  File "/export/baldwin32/anaconda3/envs/pflow3/lib/python3.8/site-packages/xarray/backends/api.py", line 557, in open_dataset
    engine = _autodetect_engine(filename_or_obj)
  File "/export/baldwin32/anaconda3/envs/pflow3/lib/python3.8/site-packages/xarray/backends/api.py", line 163, in _autodetect_engine
    engine = _get_engine_from_magic_number(filename_or_obj)
  File "/export/baldwin32/anaconda3/envs/pflow3/lib/python3.8/site-packages/xarray/backends/api.py", line 127, in _get_engine_from_magic_number
    if filename_or_obj.tell() != 0:
AttributeError: 'NoneType' object has no attribute 'tell'