Skip to content

Commit

Permalink
MAINT: remove beta cdflib support
Browse files Browse the repository at this point in the history
  • Loading branch information
jklenzing committed Nov 25, 2024
1 parent a623cd4 commit 34028bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ keywords = [
dependencies = [
"beautifulsoup4",
"cdasws",
"cdflib >= 0.4.4",
"cdflib >= 1.0",
"lxml",
"netCDF4",
"numpy",
Expand Down
22 changes: 4 additions & 18 deletions pysatNASA/instruments/methods/_cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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']:
Expand Down
7 changes: 1 addition & 6 deletions pysatNASA/instruments/methods/cdaweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34028bd

Please sign in to comment.