Skip to content

Commit

Permalink
Merge pull request #177 from pysat/sty/strict_dim_check
Browse files Browse the repository at this point in the history
  • Loading branch information
jklenzing committed Jun 6, 2023
2 parents 621f802 + 5720e60 commit cf1040a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pysatNASA/instruments/dmsp_ssusi.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
supported_tags=supported_tags)

# Set the load routine
load = functools.partial(jhuapl.load_edr_aurora, pandas_format=pandas_format)
load = functools.partial(jhuapl.load_edr_aurora, pandas_format=pandas_format,
strict_dim_check=False)

# Set the download routine
basic_tag = {'remote_dir': ''.join(('/pub/data/dmsp/dmsp{inst_id:s}/ssusi/',
Expand Down
19 changes: 15 additions & 4 deletions pysatNASA/instruments/methods/jhuapl.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def build_dtimes(data, var, epoch=None, epoch_var='time'):
return dtimes


def load_edr_aurora(fnames, tag='', inst_id='', pandas_format=False):
def load_edr_aurora(fnames, tag='', inst_id='', pandas_format=False,
strict_dim_check=True):
"""Load JHU APL EDR Aurora data and meta data.
Parameters
Expand All @@ -74,6 +75,10 @@ def load_edr_aurora(fnames, tag='', inst_id='', pandas_format=False):
(default='')
pandas_format : bool
False for xarray format, True for pandas (default=False)
strict_dim_check : bool
Used for xarray data (`pandas_format` is False). If True, warn the user
that the desired epoch, 'TIME', is not present as a dimension in the
NetCDF file. If False, no warning is raised. (default=True)
Returns
-------
Expand Down Expand Up @@ -105,7 +110,8 @@ def load_edr_aurora(fnames, tag='', inst_id='', pandas_format=False):
# than a dimension or coordinate. Additionally, no coordinates
# are assigned.
sdata, mdata = load_netcdf(fname, epoch_name='TIME', epoch_unit='s',
labels=labels, pandas_format=pandas_format)
labels=labels, pandas_format=pandas_format,
strict_dim_check=strict_dim_check)

# Calculate the time for this data file. The pysat `load_netcdf` routine
# converts the 'TIME' parameter (seconds of day) into datetime using
Expand Down Expand Up @@ -143,7 +149,7 @@ def load_edr_aurora(fnames, tag='', inst_id='', pandas_format=False):


def load_sdr_aurora(fnames, tag='', inst_id='', pandas_format=False,
combine_times=False):
strict_dim_check=True, combine_times=False):
"""Load JHU APL SDR data and meta data.
Parameters
Expand All @@ -157,6 +163,10 @@ def load_sdr_aurora(fnames, tag='', inst_id='', pandas_format=False,
(default='')
pandas_format : bool
False for xarray format, True for pandas (default=False)
strict_dim_check : bool
Used for xarray data (`pandas_format` is False). If True, warn the user
that the desired epoch, 'TIME_DAY', is not present as a dimension in the
NetCDF file. If False, no warning is raised. (default=True)```
combine_times : bool
For SDR data, optionally combine the different datetime coordinates
into a single time coordinate (default=False)
Expand Down Expand Up @@ -225,7 +235,8 @@ def load_sdr_aurora(fnames, tag='', inst_id='', pandas_format=False,
# than a dimension or coordinate. Additionally, no coordinates
# are assigned.
sdata, mdata = load_netcdf(fname, epoch_name=load_time, epoch_unit='s',
labels=labels, pandas_format=pandas_format)
labels=labels, pandas_format=pandas_format,
strict_dim_check=strict_dim_check)

# Calculate the time for this data file. The pysat `load_netcdf` routine
# converts the 'TIME' parameter (seconds of day) into datetime using
Expand Down
4 changes: 3 additions & 1 deletion pysatNASA/instruments/timed_guvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,12 @@ def load(fnames, tag='', inst_id='', combine_times=False):
"""
if tag == 'edr-aur':
data, meta = jhuapl.load_edr_aurora(fnames, tag, inst_id,
pandas_format=pandas_format)
pandas_format=pandas_format,
strict_dim_check=False)
else:
data, meta = jhuapl.load_sdr_aurora(fnames, tag, inst_id,
pandas_format=pandas_format,
strict_dim_check=False,
combine_times=combine_times)

return data, meta

0 comments on commit cf1040a

Please sign in to comment.