Skip to content

Commit

Permalink
Merge pull request #111 from isilber/IS_dev
Browse files Browse the repository at this point in the history
FIX: ACT version compatibility when loading ARM NetCDF files
  • Loading branch information
isilber authored Jan 12, 2024
2 parents 87d5a82 + d5867ba commit 64ed43e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion emc2/core/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def read_arm_netcdf_file(self, filename, **kwargs):
----------
filename: str
Additional keyword arguments are passed into :py:func:`act.io.armfiles.read_netcdf`
Additional keyword arguments are passed into :py:func:`act.io.arm.read_arm_netcdf`
"""
self.ds = load_arm_file(filename, **kwargs)
6 changes: 5 additions & 1 deletion emc2/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import xarray as xr
import numpy as np

from act.io.armfiles import read_netcdf
try:
from act.io.arm import read_arm_netcdf as read_netcdf
except:
print('Using act-atmos v1.5.3 or earlier. Please update to v2.0.0 or newer')
from act.io.armfiles import read_netcdf
from .instrument import ureg, quantity
from netCDF4 import Dataset
from ..scattering import brandes
Expand Down
8 changes: 6 additions & 2 deletions emc2/io/load_obs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from act.io.armfiles import read_netcdf
try:
from act.io.arm import read_arm_netcdf as read_netcdf
except:
print('Using act-atmos v1.5.3 or earlier. Please update to v2.0.0 or newer')
from act.io.armfiles import read_netcdf


def load_arm_file(filename, **kwargs):
Expand All @@ -10,7 +14,7 @@ def load_arm_file(filename, **kwargs):
filename: str
The name of the file to load.
Additional keyword arguments are passed into :py:func:`act.io.armfiles.read_netcdf`
Additional keyword arguments are passed into :py:func:`act.io.arm.read_arm_netcdf`
Returns
-------
Expand Down
10 changes: 8 additions & 2 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ def test_plot_regridded_CF_timeseries():
atb_total_4D, atb_mol_4D, subcolum_num, time_num, z_full_km_3D, z_half_km_3D,
Ncolumns, Npoints, Nlevels, Nglevels, col_num, newgrid_bot, newgrid_top)
# Set input parameters.
cmap = 'act_HomeyerRainbow'
try:
cmap = 'HomeyerRainbow'
except:
cmap = 'act_HomeyerRainbow'
field_to_plot = ["CF"]
vmin_max = [(0., 1.)]
log_plot = [False]
Expand Down Expand Up @@ -239,7 +242,10 @@ def test_plot_subcolumn_timeseries():
my_e3sm = emc2.simulator.main.make_simulated_data(
my_e3sm, KAZR, N_sub,do_classify=False, convert_zeros_to_nan=True,
unstack_dims=True, finalize_fields=True,use_rad_logic=True)
cmap = 'act_HomeyerRainbow'
try:
cmap = 'HomeyerRainbow'
except:
cmap = 'act_HomeyerRainbow'
field_to_plot = ["sub_col_beta_p_tot", "sub_col_Ze_att_tot"]
vmin_max = [(1e-8, 1e-3), (-50., 10.)]
log_plot = [True, False]
Expand Down

0 comments on commit 64ed43e

Please sign in to comment.