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 xarray FrozenDict call #291

Merged
merged 1 commit into from
Oct 21, 2019
Merged
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
15 changes: 9 additions & 6 deletions siphon/cdmr/xarray_support.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Copyright (c) 2016 Siphon Contributors.
# Copyright (c) 2016,2019 Siphon Contributors.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Implement an experimental backend for using xarray to talk to TDS over CDMRemote."""

from xarray import Variable
from xarray.backends.common import AbstractDataStore, BackendArray
from xarray.core import indexing
from xarray.core.utils import FrozenOrderedDict
try:
from xarray.core.utils import FrozenDict
except ImportError:
from xarray.core.utils import FrozenOrderedDict as FrozenDict

from . import Dataset

Expand Down Expand Up @@ -56,13 +59,13 @@ def open_store_variable(self, name, var):

def get_variables(self):
"""Get the variables from underlying data set."""
return FrozenOrderedDict((k, self.open_store_variable(k, v))
for k, v in self.ds.variables.items())
return FrozenDict((k, self.open_store_variable(k, v))
for k, v in self.ds.variables.items())

def get_attrs(self):
"""Get the global attributes from underlying data set."""
return FrozenOrderedDict((a, getattr(self.ds, a)) for a in self.ds.ncattrs())
return FrozenDict((a, getattr(self.ds, a)) for a in self.ds.ncattrs())

def get_dimensions(self):
"""Get the dimensions from underlying data set."""
return FrozenOrderedDict((k, len(v)) for k, v in self.ds.dimensions.items())
return FrozenDict((k, len(v)) for k, v in self.ds.dimensions.items())