Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
CLIMATE-948 cleanup podaac_datasource to accomodate Podaacpy 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lewismc committed Mar 14, 2018
1 parent 8e1edc8 commit ad5757d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
23 changes: 9 additions & 14 deletions ocw/data_source/podaac_datasource.py
Expand Up @@ -46,29 +46,24 @@ def convert_times_to_datetime(time):
return [parsed_time.num2date(x) for x in time[:]]


def list_available_extract_granule_dataset_ids():
def list_available_level4_extract_granule_dataset_ids():
'''Convenience function which returns an up-to-date \
list of available granule dataset id's which can be \
list of available level4 blended granule dataset id's which can be \
used in the granule extraction service.
:returns: a comma-seperated list of granule dataset id's.
'''
podaac_utils = PodaacUtils()
return podaac_utils.list_available_extract_granule_dataset_ids()
return podaac_utils.list_level4_dataset_ids()

def subset_granule(variable, dataset_id='', name='', path='/tmp', input_file_path=''):
def subset_granule(variable, name='', path='/tmp', input_file_path=''):
'''Subset Granule service allows users to Submit subset jobs. \
Use of this service should be preceded by a Granule Search in \
order to identify and generate a list of granules to be subsetted.
:param variable: The name of the variable to read from the dataset.
:type variable: :mod:`string`
:param dataset_id: dataset persistent ID. datasetId or \
shortName is required for a granule search. Example: \
PODAAC-ASOP2-25X01
:type dataset_id: :mod:`string`
:param name: (Optional) A name for the loaded dataset.
:type name: :mod:`string`
Expand All @@ -95,9 +90,9 @@ def extract_l4_granule(variable, dataset_id='', name='', path='/tmp'):
:param variable: The name of the variable to read from the dataset.
:type variable: :mod:`string`
:param dataset_id: dataset persistent ID. datasetId or \
shortName is required for a granule search. Example: \
PODAAC-ASOP2-25X01
:param dataset_id: dataset persistent ID. datasetId \
is required for a granule search. Example: \
PODAAC-CCF35-01AD5
:type dataset_id: :mod:`string`
:param name: (Optional) A name for the loaded dataset.
Expand Down Expand Up @@ -147,8 +142,8 @@ def read_dataset(name='', granule_name ='', variable=None, path='/tmp'):
lons = np.array(d.variables[lon][:])
values = np.array(dataset[:])
origin = {
'source': 'PO.DAAC',
'url': 'podaac.jpl.nasa.gov'
'source': 'NASA JPL PO.DAAC',
'url': 'https://podaac.jpl.nasa.gov'
}

# Removing the downloaded temporary granule before creating the OCW
Expand Down
4 changes: 2 additions & 2 deletions ocw/tests/test_podaac.py
Expand Up @@ -74,8 +74,8 @@ def test_valid_date_conversion(self):

def test_dataset_origin(self):
print('in test_dataset_origin')
self.assertEquals(self.dataset.origin['source'], 'PO.DAAC')
self.assertEquals(self.dataset.origin['url'], 'podaac.jpl.nasa.gov')
self.assertEquals(self.dataset.origin['source'], 'NASA JPL PO.DAAC')
self.assertEquals(self.dataset.origin['url'], 'https://podaac.jpl.nasa.gov')

def test_custom_name(self):
print('in test_custom_name')
Expand Down

0 comments on commit ad5757d

Please sign in to comment.