Repository: climate Updated Branches: refs/heads/master 28964ae74 -> 7e53612bd
CLIMATE-853 Fixing broken documentation in dap.py and making it PEP8 compliant Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/83c19de7 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/83c19de7 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/83c19de7 Branch: refs/heads/master Commit: 83c19de75b0976e0b06a0a6c8b171ea4bb901ce9 Parents: 817c854 Author: Omkar20895 <omkarreddy2...@gmail.com> Authored: Wed Aug 17 22:50:22 2016 +0530 Committer: Omkar20895 <omkarreddy2...@gmail.com> Committed: Wed Aug 17 22:50:22 2016 +0530 ---------------------------------------------------------------------- ocw/data_source/dap.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/83c19de7/ocw/data_source/dap.py ---------------------------------------------------------------------- diff --git a/ocw/data_source/dap.py b/ocw/data_source/dap.py index fc9d2a3..663bc36 100644 --- a/ocw/data_source/dap.py +++ b/ocw/data_source/dap.py @@ -47,18 +47,21 @@ def load(url, variable, name=''): # but conventions aren't always followed and all dimensions aren't always present so # see if we can make some educated deductions before defaulting to just pulling the first three # columns. - temp_dimensions = map(lambda x:x.lower(),dataset.dimensions) + temp_dimensions = map(lambda x: x.lower(), dataset.dimensions) dataset_dimensions = dataset.dimensions - time = dataset_dimensions[temp_dimensions.index('time') if 'time' in temp_dimensions else 0] - lat = dataset_dimensions[temp_dimensions.index('lat') if 'lat' in temp_dimensions else 1] - lon = dataset_dimensions[temp_dimensions.index('lon') if 'lon' in temp_dimensions else 2] + time = dataset_dimensions[temp_dimensions.index( + 'time') if 'time' in temp_dimensions else 0] + lat = dataset_dimensions[temp_dimensions.index( + 'lat') if 'lat' in temp_dimensions else 1] + lon = dataset_dimensions[temp_dimensions.index( + 'lon') if 'lon' in temp_dimensions else 2] # Time is given to us in some units since an epoch. We need to convert # these values to datetime objects. Note that we use the main object's # time object and not the dataset specific reference to it. We need to # grab the 'units' from it and it fails on the dataset specific object. - times = np.array(_convert_times_to_datetime(d[time])) + times = np.array(convert_times_to_datetime(d[time])) lats = np.array(dataset[lat][:]) lons = np.array(dataset[lon][:]) @@ -73,7 +76,7 @@ def load(url, variable, name=''): name=name, origin=origin) -def _convert_times_to_datetime(time): +def convert_times_to_datetime(time): '''Convert the OpenDAP time object's values to datetime objects The time values are stored as some unit since an epoch. These need to be