Skip to content

Commit

Permalink
#2772 Changed API
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Jan 29, 2024
1 parent 549ff3d commit 858a484
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/python/pyembed/write_tmp_point_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@
except:
from pyembed.python_embedding import pyembed_tools

from met.point import met_point_tools
try:
from point import get_empty_point_obs
except:
from met.point import get_empty_point_obs


if __name__ == '__main__':
tmp_filename = sys.argv[1]
met_in = pyembed_tools.call_python(sys.argv)

if hasattr(met_in, 'point_data'):
if hasattr(met_in, 'point_obs_data'):
met_in.point_obs_data.write_point_data(tmp_filename)
elif hasattr(met_in, 'point_data'):
pyembed_tools.write_tmp_ascii(tmp_filename, met_in.point_data)
elif hasattr(met_in, 'point_obs_data'):
met_in.point_obs_data.save_ncfile(tmp_filename)
else:
if hasattr(met_in.met_point_data, 'point_obs_data'):
met_in.met_point_data['point_obs_data'].save_ncfile(tmp_filename)
met_in.met_point_data['point_obs_data'].write_point_data(tmp_filename)
else:
tmp_point_obs = met_point_tools.get_nc_point_obs()
tmp_point_obs = get_empty_point_obs()
tmp_point_obs.put_data(met_in.met_point_data)
tmp_point_obs.save_ncfile(tmp_filename)

0 comments on commit 858a484

Please sign in to comment.