Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #301 from djhoese/feature-satpy-dataids
Add support for Satpy 0.23+ and PROJ 6.0+
- Loading branch information
Showing
7 changed files
with
160 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
"""Wrappers around Satpy to handle changes between versions.""" | ||
|
||
try: | ||
from satpy import DataID | ||
|
||
def get_id_value(id_obj, key, default=None): | ||
return id_obj.get(key, default) | ||
|
||
def get_id_items(id_obj): | ||
return id_obj.items() | ||
|
||
def id_from_attrs(attrs): | ||
return attrs['_satpy_id'] | ||
except ImportError: | ||
import warnings | ||
warnings.warn("Satpy <0.23.0 will not be supported in future versions. " | ||
"Please update your version of Satpy.", DeprecationWarning) | ||
from satpy import DatasetID as DataID | ||
|
||
def get_id_value(id_obj, key, default=None): | ||
return getattr(id_obj, key, default) | ||
|
||
def get_id_items(id_obj): | ||
return id_obj._asdict().items() | ||
|
||
def id_from_attrs(attrs): | ||
return DataID.from_dict(attrs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.