Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update keys call in cdscan for Python 3 #399

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Lib/cdscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def combineKeys(mydict, typedict, timeIsLinear=0,
global verbose

# Sort the projected time, level indices
keys = OrderedDict(sorted(mydict.items())).keys()
keys = list(OrderedDict(sorted(mydict.items())).keys())

axislist = []
prevend = None
Expand Down Expand Up @@ -396,7 +396,7 @@ def useKeys(mydict, typedict, timeIsLinear=0,
global verbose

# Sort the projected time, level indices
keys = OrderedDict(sorted(mydict.items())).keys()
keys = list(OrderedDict(sorted(mydict.items())).keys())

axislist = []
name0 = None
Expand Down Expand Up @@ -1118,7 +1118,7 @@ def gensuffix(m, mo=mo):
# was if axis.isTime() and hasattr(axis, 'bounds'):
if axis.isTime() and (axis.getBounds() is not None):
tmpdict[axis.bounds] = 1
boundsids = tmpdict.keys()
boundsids = list(tmpdict.keys())

# For forecasts, get the time at which the forecast begins (tau=0) which
# is nbdate,nbsec
Expand All @@ -1133,7 +1133,7 @@ def gensuffix(m, mo=mo):
nbsec, cdtime.Seconds) # fctau0 as type comptime
fc_time_attrs = []

varnames = f.variables.keys()
varnames = list(f.variables.keys())

# Try to force all axes to be included, but only small ones, length<100.
# This section was motivated by a need to preserve the cloud axes isccp_prs,isccp_tau.
Expand Down Expand Up @@ -1377,7 +1377,7 @@ def gensuffix(m, mo=mo):
# identical varentry values.
varindex = []
# varnames = sorted(filemap.keys())
varnames = OrderedDict(sorted(filemap.items())).keys()
varnames = list(OrderedDict(sorted(filemap.items())).keys())

for varname in varnames:
varentry = sorted(filemap[varname])
Expand Down Expand Up @@ -1663,7 +1663,7 @@ def gensuffix(m, mo=mo):
else:
newslicedict[(i0, i1, j0, j1, fctau0)] = path
# keys = sorted(newslicedict.keys())
keys = OrderedDict(sorted(newslicedict.items())).keys()
keys = list(OrderedDict(sorted(newslicedict.items())).keys())

newslicelist = []
for i0, i1, j0, j1, fctau0 in keys:
Expand Down Expand Up @@ -1715,7 +1715,7 @@ def gensuffix(m, mo=mo):
validateAttrs(datasetnode)

timeWasOverridden = 0
keys = OrderedDict(sorted(axisdict.items())).keys()
keys = list(OrderedDict(sorted(axisdict.items())).keys())
for key in keys:
axis = axisdict[key]
tcode = axis.typecode()
Expand Down Expand Up @@ -1776,7 +1776,7 @@ def gensuffix(m, mo=mo):
# keys = sorted(vardict.keys())
# keys = vardict.keys()
# keys = list(keys).sort()
keys = OrderedDict(sorted(vardict.items())).keys()
keys = list(OrderedDict(sorted(vardict.items())).keys())
for key in keys:
if (includeList is not None) and (key not in includeList):
continue
Expand Down
4 changes: 2 additions & 2 deletions Lib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ def getPaths(self):
for var in list(self.variables.values()):
for path, stuple in var.getPaths():
pathdict[path] = 1
result = sorted(pathdict.keys())
result = sorted(list(pathdict.keys()))
return result

# Open a data file associated with this dataset.
Expand Down Expand Up @@ -1340,7 +1340,7 @@ def __init__(self, path, mode, hostObj=None, mpiBarrier=False):
else:
cdunifvar = None
self.axes[name] = FileAxis(self, name, cdunifvar)
self.axes = OrderedDict(sorted(self.axes.items()))
self.axes = OrderedDict(sorted(list(self.axes.items())))

# Attach boundary variables
for name in coordsaux:
Expand Down