Skip to content

Commit 34028bd

Browse files
committed
MAINT: remove beta cdflib support
1 parent a623cd4 commit 34028bd

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ keywords = [
3939
dependencies = [
4040
"beautifulsoup4",
4141
"cdasws",
42-
"cdflib >= 0.4.4",
42+
"cdflib >= 1.0",
4343
"lxml",
4444
"netCDF4",
4545
"numpy",

pysatNASA/instruments/methods/_cdf.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def __init__(self, filename,
104104
self._variable_names = (self._cdf_info.rVariables
105105
+ self._cdf_info.zVariables)
106106
else:
107-
# cdflib < 1.0 stores info as a dict
108107
self._variable_names = (self._cdf_info['rVariables']
109108
+ self._cdf_info['zVariables'])
110109

@@ -170,13 +169,8 @@ def set_epoch(self, x_axis_var):
170169
171170
"""
172171

173-
if hasattr(self._cdf_file.varinq(x_axis_var), 'Data_Type_Description'):
174-
data_type_description = self._cdf_file.varinq(
175-
x_axis_var).Data_Type_Description
176-
else:
177-
# cdflib < 1.0 stores this as a dict
178-
data_type_description = self._cdf_file.varinq(
179-
x_axis_var)['Data_Type_Description']
172+
data_type_description = self._cdf_file.varinq(
173+
x_axis_var).Data_Type_Description
180174

181175
center_measurement = self._center_measurement
182176
cdf_file = self._cdf_file
@@ -317,11 +311,7 @@ def load_variables(self):
317311
if not re.match(var_regex, variable_name):
318312
# Skip this variable
319313
continue
320-
try:
321-
var_atts = self._cdf_file.varattsget(variable_name, to_np=True)
322-
except TypeError:
323-
# cdflib 1.0+ drops to_np kwarg, assumes True
324-
var_atts = self._cdf_file.varattsget(variable_name)
314+
var_atts = self._cdf_file.varattsget(variable_name, to_np=True)
325315

326316
for k in var_atts:
327317
var_atts[k] = var_atts[k] # [0]
@@ -343,11 +333,7 @@ def load_variables(self):
343333
continue
344334

345335
if "FILLVAL" in var_atts:
346-
if hasattr(var_properties, 'Data_Type_Description'):
347-
data_type_desc = var_properties.Data_Type_Description
348-
else:
349-
# cdflib < 1.0 stores this as a dict
350-
data_type_desc = var_properties['Data_Type_Description']
336+
data_type_desc = var_properties.Data_Type_Description
351337

352338
if data_type_desc in ['CDF_FLOAT', 'CDF_REAL4', 'CDF_DOUBLE',
353339
'CDF_REAL8']:

pysatNASA/instruments/methods/cdaweb.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@
3636
from pysat.utils import io
3737
from pysatNASA.instruments.methods import CDF as libCDF
3838

39-
try:
40-
# cdflib 1.0 syntax
41-
from cdflib.xarray import cdf_to_xarray
42-
except ModuleNotFoundError:
43-
# cdflib 0.4 syntax required for backwards compatibility
44-
from cdflib import cdf_to_xarray
39+
from cdflib.xarray import cdf_to_xarray
4540

4641
try:
4742
# Use pysatCDF as default for pandas data sets

0 commit comments

Comments
 (0)