spectraphilic/reflexible

Compatibility with FLEXPART 10 output?

andreas-h opened this issue · 2 comments

I have trouble loading FLEXPART 10 output (from the v10.2beta tag in Git) into reflexible:

fprun = rf.Flexpart('/home/stud_tpl/flexpart/example_170701_05_deg01_P_05h_IOUT5_ERA_FP10/pathnames')

raises

/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/flexpart.py:45: UserWarning: NetCDF4 files not found in output directory '/home/stud_tpl/flexpart/example_170701_05_deg01_P_05h_IOUT5_ERA_FP10/output'.  You can always generate them from data there with the `create_ncfile` command line utility.
  self.fp_output))
Traceback (most recent call last):
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/legacy_structures.py", line 260, in __init__
    h = reflexible.conv2netcdf4.read_header(path, **readheader_ops)
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/flexpart_read.py", line 990, in read_header
    h[v] = np.zeros(h['numpoint'])
ValueError: negative dimensions are not allowed
ERROR:root:An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 71))

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-32-df09aa34abef> in <module>()
----> 1 fprun = rf.Flexpart('/home/stud_tpl/flexpart/example_170701_05_deg01_P_05h_IOUT5_ERA_FP10/pathnames')

/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/flexpart.pyc in __init__(self, pathnames, nested)
     44                 "with the `create_ncfile` command line utility.".format(
     45                     self.fp_output))
---> 46             self.Header = conv.Header(self.fp_output, nested=nested)
     47 
     48         # Other config files

/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/legacy_structures.pyc in __init__(self, path, headerfile, version, **readheader_ops)
    266             raise IOError('''
    267             Could not set header variables.
--> 268             Does the `header` or `header_nest` file exist in path?\n{0}'''.format(path))
    269 
    270     def lonlat(self):

IOError: 
            Could not set header variables.
            Does the `header` or `header_nest` file exist in path?
/home/stud_tpl/flexpart/example_170701_05_deg01_P_05h_IOUT5_ERA_FP10/output

> /home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/legacy_structures.py(268)__init__()
    266             raise IOError('''
    267             Could not set header variables.
--> 268             Does the `header` or `header_nest` file exist in path?\n{0}'''.format(path))
    269 
    270     def lonlat(self):

Also, if I try to convert to netCDF manually using create_ncfile, I get

$ create_ncfile ./pathnames 
Traceback (most recent call last):
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/legacy_structures.py", line 260, in __init__
    h = reflexible.conv2netcdf4.read_header(path, **readheader_ops)
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/flexpart_read.py", line 990, in read_header
    h[v] = np.zeros(h['numpoint'])
ValueError: negative dimensions are not allowed
Traceback (most recent call last):
  File "/home/stud_tpl/miniconda3/envs/flexpart/bin/create_ncfile", line 11, in <module>
    load_entry_point('reflexible==0.5.0', 'console_scripts', 'create_ncfile')()
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/scripts/create_ncfile.py", line 708, in main
    args.dirout, args.outfile)
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/scripts/create_ncfile.py", line 602, in create_ncfile
    H = Header(output_dir, nested=nested)
  File "/home/stud_tpl/miniconda3/envs/flexpart/lib/python2.7/site-packages/reflexible-0.5.0-py2.7.egg/reflexible/conv2netcdf4/legacy_structures.py", line 268, in __init__
    Does the `header` or `header_nest` file exist in path?\n{0}'''.format(path))
IOError: 
            Could not set header variables.
            Does the `header` or `header_nest` file exist in path?
output

However, the header file does exist in the correct path:

$ cat pathnames 
./options/
./output/
/data/meteo/
/data/meteo/AVAILABLE
============================================

and

$ find output/ -name header
output/header

Should this work? What do I need to do in order to read FLEXPART10 output with readflexible?

I have the same quesiton,have you solved it?