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

Fix GiniFile import of xarray FrozenDict #1204

Merged
merged 1 commit into from
Oct 16, 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 src/metpy/io/gini.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015,2016,2017 MetPy Developers.
# Copyright (c) 2015,2016,2017,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tools to process GINI-formatted products."""
Expand All @@ -19,7 +19,10 @@
try:
from xarray import Variable
from xarray.backends.common import AbstractDataStore
from xarray.core.utils import FrozenOrderedDict
try:
from xarray.core.utils import FrozenDict
except ImportError:
from xarray.core.utils import FrozenOrderedDict as FrozenDict
except ImportError:
# This way GiniFile is still usable without xarray
AbstractDataStore = object
Expand Down Expand Up @@ -403,21 +406,21 @@ def get_variables(self):
attrs=attrs)
variables.append((name, data_var))

return FrozenOrderedDict(variables)
return FrozenDict(variables)

def get_attrs(self):
"""Get the global attributes.

This is used by `xarray.open_dataset`.

"""
return FrozenOrderedDict(satellite=self.prod_desc.creating_entity,
sector=self.prod_desc.sector_id)
return FrozenDict(satellite=self.prod_desc.creating_entity,
sector=self.prod_desc.sector_id)

def get_dimensions(self):
"""Get the file's dimensions.

This is used by `xarray.open_dataset`.

"""
return FrozenOrderedDict(x=self.prod_desc.nx, y=self.prod_desc.ny)
return FrozenDict(x=self.prod_desc.nx, y=self.prod_desc.ny)