CLIMATE-594 - Add 'origin' attribute to Dataset class - Add 'origin' attribute to the Dataset class for tracking where a dataset was loaded from. Future commits will update the data sources so that this attribute is set.
Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/d4f2b50f Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/d4f2b50f Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/d4f2b50f Branch: refs/heads/master Commit: d4f2b50ff1c6531e6c4589aa72c6c04916f7911a Parents: 6e73c8a Author: Michael Joyce <[email protected]> Authored: Fri Feb 27 10:39:53 2015 -0800 Committer: Michael Joyce <[email protected]> Committed: Fri Feb 27 10:39:53 2015 -0800 ---------------------------------------------------------------------- ocw/dataset.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/d4f2b50f/ocw/dataset.py ---------------------------------------------------------------------- diff --git a/ocw/dataset.py b/ocw/dataset.py index 1d4b2d8..3d2cc48 100644 --- a/ocw/dataset.py +++ b/ocw/dataset.py @@ -35,7 +35,8 @@ logger = logging.getLogger(__name__) class Dataset: '''Container for a dataset's attributes and data.''' - def __init__(self, lats, lons, times, values, variable=None, name=""): + def __init__(self, lats, lons, times, values, variable=None, name="", + origin=None): '''Default Dataset constructor :param lats: One dimensional numpy array of unique latitude values. @@ -58,6 +59,10 @@ class Dataset: :param name: An optional string name for the Dataset. :type name: :mod:`string` + :param origin: An optional object used to specify information on where + this dataset was loaded from. + :type origin: :class:`dict` + :raises: ValueError ''' self._validate_inputs(lats, lons, times, values) @@ -69,6 +74,7 @@ class Dataset: self.values = values self.variable = variable self.name = name + self.origin = origin def spatial_boundaries(self): '''Calculate the spatial boundaries.
