Commit c77cc444 authored by R.K.Garcia's avatar R.K.Garcia
Browse files

candidate fix for AWIPS2 16/17 netcdf read problems

parent bed3bccb
......@@ -901,6 +901,22 @@ def default_filename(scene):
raise NotImplementedError("default_filename is not yet implemented")
def workaround_awips16_17(ncpath):
patch from DHoese for AWIPS2 16.4.1 and 17.1.1 NetCDF reader giving Error 72
:param ncpath: NetCDF file to patch
:return: None
# hack to get files created by new NetCDF library
# versions to be read by AWIPS buggy java version
# of NetCDF"Modifying SCMI NetCDF file to work with AWIPS")
import h5py
h = h5py.File(ncpath, 'a')
if '_NCProperties' in h.attrs:
del h.attrs['_NCProperties']
def hsd2scmi(scene, filename=None, include_rad=False,
include_geo=False, include_fgf=True,
......@@ -1127,6 +1143,8 @@ def main():
parser.add_argument('-R', '--region', help='region tag to use in filename, e.g. HFD', default='HFD')
parser.add_argument('-E', '--environment', default='DT',
help='environment and data type to use in filename, e.g. DT or OR')
parser.add_argument('--fix', default=False, action='store_true',
help='apply netCDF "HDF Error 72" workaround for AWIPS2 16.4.1 and 17.1.1')
parser.add_argument('--debug', dest='debug', action='store_true',
help="enable interactive PDB debugger on exception")
# FUTURE: include a resolution tag for 2km/1km/0p5km
......@@ -1160,6 +1178,8 @@ def main():
tile_count=_parse_tile_count(args.tiles), nav_scene=attach_nav(args.nav_donor),
environment=environment, data_type=data_type, region=args.region))
for fn in fns:
if args.fix:
print("> " + fn)
return 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment