Skip to content

Commit

Permalink
Bugfix 2428 python csv input (#2467)
Browse files Browse the repository at this point in the history
Co-authored-by: Howard Soh <hsoh@seneca.rap.ucar.edu>
  • Loading branch information
hsoh-u and Howard Soh authored Feb 27, 2023
1 parent fc44d23 commit 89d32c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/python/met_point_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def log_info(self, info_msg):
base_met_point_obs.info_msg(info_msg)

def put_data(self, point_obs_dict):
self.use_var_id = point_obs_dict['use_var_id']
self.hdr_typ = point_obs_dict['hdr_typ']
self.hdr_sid = point_obs_dict['hdr_sid']
self.hdr_vld = point_obs_dict['hdr_vld']
Expand Down Expand Up @@ -446,6 +447,7 @@ def convert_point_data(self):
hdr_vld_map = {}
obs_var_map = {}
obs_qty_map = {}
self.use_var_id = not self.is_grib_code()

self.use_var_id = not self.is_grib_code()

Expand Down
5 changes: 5 additions & 0 deletions scripts/python/met_point_obs_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def read_data(self, nc_filename):
self.log_error_msg(f"input NetCDF file ({nc_filename}) does not exist")
else:
dataset = nc.Dataset(nc_filename, 'r')

attr_name = 'use_var_id'
use_var_id_str = dataset.getncattr(attr_name) if attr_name in dataset.ncattrs() else "false"
self.use_var_id = use_var_id_str.lower() == 'true'

# Header
self.hdr_typ = dataset['hdr_typ'][:]
self.hdr_sid = dataset['hdr_sid'][:]
Expand Down

0 comments on commit 89d32c0

Please sign in to comment.