Skip to content

Commit

Permalink
Merge pull request #1204 from zbruick/xarray_update
Browse files Browse the repository at this point in the history
Fix GiniFile import of xarray FrozenDict
  • Loading branch information
dopplershift committed Oct 16, 2019
2 parents e3137a9 + 3244f6b commit 7e506b8
Showing 1 changed file with 9 additions and 6 deletions.
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)

0 comments on commit 7e506b8

Please sign in to comment.