This is an automated email from the ASF dual-hosted git repository. tloubrieu pushed a commit to branch ascending_latitudes in repository https://gitbox.apache.org/repos/asf/incubator-sdap-ingester.git
commit 677fb5766df47e0bdad0a9c084830d4bf99b4333 Author: Eamon Ford <[email protected]> AuthorDate: Tue Jan 5 14:03:47 2021 -0800 KelvinToCelsius converter can now parse 'units' or 'Units' field and exits gracefully if none exists (#28) --- collection_manager/collection_manager/services/S3Observer.py | 2 -- .../granule_ingester/processors/kelvintocelsius.py | 10 +++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/collection_manager/collection_manager/services/S3Observer.py b/collection_manager/collection_manager/services/S3Observer.py index 87458a9..6d87d91 100644 --- a/collection_manager/collection_manager/services/S3Observer.py +++ b/collection_manager/collection_manager/services/S3Observer.py @@ -109,8 +109,6 @@ class S3Observer: end = time.perf_counter() duration = end - start - print(f"Retrieved {len(new_cache)} objects in {duration}") - return new_cache def _get_object_key(full_path: str): diff --git a/granule_ingester/granule_ingester/processors/kelvintocelsius.py b/granule_ingester/granule_ingester/processors/kelvintocelsius.py index 9ad4f49..c0a9285 100644 --- a/granule_ingester/granule_ingester/processors/kelvintocelsius.py +++ b/granule_ingester/granule_ingester/processors/kelvintocelsius.py @@ -27,7 +27,15 @@ class KelvinToCelsius(TileProcessor): if 'dataset' in kwargs: ds = kwargs['dataset'] variable_name = tile.summary.data_var_name - variable_unit = ds.variables[variable_name].attrs['units'] + if 'units' in ds.variables[variable_name].attrs: + variable_unit = ds.variables[variable_name].attrs['units'] + elif 'Units' in ds.variables[variable_name].attrs: + variable_unit = ds.variables[variable_name].attrs['Units'] + elif 'UNITS' in ds.variables[variable_name].attrs: + variable_unit = ds.variables[variable_name].attrs['UNITS'] + else: + return tile + if any([unit in variable_unit.lower() for unit in kelvins]): var_data = from_shaped_array(the_tile_data.variable_data) - 273.15 the_tile_data.variable_data.CopyFrom(to_shaped_array(var_data))
