diff --git a/pyproject.toml b/pyproject.toml index 49306051..b5950de0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ keywords = [ dependencies = [ "beautifulsoup4", "cdasws", - "cdflib >= 0.4.4", + "cdflib >= 1.0", "lxml", "netCDF4", "numpy", diff --git a/pysatNASA/instruments/methods/_cdf.py b/pysatNASA/instruments/methods/_cdf.py index 34f6dd10..493f0813 100644 --- a/pysatNASA/instruments/methods/_cdf.py +++ b/pysatNASA/instruments/methods/_cdf.py @@ -104,7 +104,6 @@ def __init__(self, filename, self._variable_names = (self._cdf_info.rVariables + self._cdf_info.zVariables) else: - # cdflib < 1.0 stores info as a dict self._variable_names = (self._cdf_info['rVariables'] + self._cdf_info['zVariables']) @@ -170,13 +169,8 @@ def set_epoch(self, x_axis_var): """ - if hasattr(self._cdf_file.varinq(x_axis_var), 'Data_Type_Description'): - data_type_description = self._cdf_file.varinq( - x_axis_var).Data_Type_Description - else: - # cdflib < 1.0 stores this as a dict - data_type_description = self._cdf_file.varinq( - x_axis_var)['Data_Type_Description'] + data_type_description = self._cdf_file.varinq( + x_axis_var).Data_Type_Description center_measurement = self._center_measurement cdf_file = self._cdf_file @@ -317,11 +311,7 @@ def load_variables(self): if not re.match(var_regex, variable_name): # Skip this variable continue - try: - var_atts = self._cdf_file.varattsget(variable_name, to_np=True) - except TypeError: - # cdflib 1.0+ drops to_np kwarg, assumes True - var_atts = self._cdf_file.varattsget(variable_name) + var_atts = self._cdf_file.varattsget(variable_name, to_np=True) for k in var_atts: var_atts[k] = var_atts[k] # [0] @@ -343,11 +333,7 @@ def load_variables(self): continue if "FILLVAL" in var_atts: - if hasattr(var_properties, 'Data_Type_Description'): - data_type_desc = var_properties.Data_Type_Description - else: - # cdflib < 1.0 stores this as a dict - data_type_desc = var_properties['Data_Type_Description'] + data_type_desc = var_properties.Data_Type_Description if data_type_desc in ['CDF_FLOAT', 'CDF_REAL4', 'CDF_DOUBLE', 'CDF_REAL8']: diff --git a/pysatNASA/instruments/methods/cdaweb.py b/pysatNASA/instruments/methods/cdaweb.py index b0e71803..f3efea7d 100644 --- a/pysatNASA/instruments/methods/cdaweb.py +++ b/pysatNASA/instruments/methods/cdaweb.py @@ -36,12 +36,7 @@ from pysat.utils import io from pysatNASA.instruments.methods import CDF as libCDF -try: - # cdflib 1.0 syntax - from cdflib.xarray import cdf_to_xarray -except ModuleNotFoundError: - # cdflib 0.4 syntax required for backwards compatibility - from cdflib import cdf_to_xarray +from cdflib.xarray import cdf_to_xarray try: # Use pysatCDF as default for pandas data sets