Skip to content

Commit

Permalink
#2428 Set use_var_id from the global attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Feb 23, 2023
1 parent 447ac0b commit 4eba029
Showing 1 changed file with 5 additions and 0 deletions.
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 4eba029

Please sign in to comment.