From c2f90a037514aa6891a4be7bf932fc7c409a281d Mon Sep 17 00:00:00 2001 From: NoaMillsUSDA-ARS Date: Wed, 24 Jan 2024 15:07:20 -0800 Subject: [PATCH 1/4] Fixed crs/resolution issue that caused no data in bounds errors --- src/api_core/helpers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/api_core/helpers.py b/src/api_core/helpers.py index 2688299..ecb0b74 100644 --- a/src/api_core/helpers.py +++ b/src/api_core/helpers.py @@ -155,10 +155,8 @@ def get_target_crs(input_crs_str, resolution, user_geom): # in the clip geometry. if input_crs_str is not None: target_crs = CRS(input_crs_str) - elif input_crs_str is None and resolution is not None: - target_crs = user_geom.geom.crs else: - target_crs = None + target_crs = user_geom.geom.crs return target_crs From 34dde0995b014e460c0ce5eb293dbb4648f43314 Mon Sep 17 00:00:00 2001 From: NoaMillsUSDA-ARS Date: Thu, 1 Feb 2024 14:59:29 -0800 Subject: [PATCH 2/4] Added temporary geometry for raster clipping --- src/api_core/data_request_handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api_core/data_request_handler.py b/src/api_core/data_request_handler.py index 60b7700..c76cc99 100644 --- a/src/api_core/data_request_handler.py +++ b/src/api_core/data_request_handler.py @@ -132,14 +132,15 @@ def _getRasterLayer( match_data_array=target_data, resampling=Resampling[ri_method] ) + temp_geom = request.subset_geom # If raster reprojection is not needed, then reproject subset_geom # to match the crs of the data else: - request.subset_geom = request.subset_geom.reproject( + temp_geom = request.subset_geom.reproject( data.rio.crs) # Clip to the non-modified requested geometry - data = data.rio.clip([request.subset_geom.json], all_touched = True) + data = data.rio.clip([temp_geom.json], all_touched = True) # Assign time coordinate to request date. # Overwrite native time format if present. From 0f468d9454be157380cdca216baa58b7ad27a995 Mon Sep 17 00:00:00 2001 From: NoaMillsUSDA-ARS Date: Tue, 6 Feb 2024 14:08:13 -0800 Subject: [PATCH 3/4] Reverted incorrect attempt to fix crs bug in get_target_crs function --- src/api_core/helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api_core/helpers.py b/src/api_core/helpers.py index ecb0b74..9870f06 100644 --- a/src/api_core/helpers.py +++ b/src/api_core/helpers.py @@ -155,10 +155,10 @@ def get_target_crs(input_crs_str, resolution, user_geom): # in the clip geometry. if input_crs_str is not None: target_crs = CRS(input_crs_str) - else: + elif input_crs_str is None and resolution is not None: target_crs = user_geom.geom.crs + else: + target_crs = None return target_crs - - From 034fc1996d96d15bb9733e29d0cf9902c75a4919 Mon Sep 17 00:00:00 2001 From: Noa Mills Date: Fri, 3 May 2024 12:22:32 -0700 Subject: [PATCH 4/4] Updated grain_method description --- src/api_core/data_request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api_core/data_request.py b/src/api_core/data_request.py index 779ff42..93ef1c1 100644 --- a/src/api_core/data_request.py +++ b/src/api_core/data_request.py @@ -68,7 +68,10 @@ def __init__( months: Months to include in the request. days: Days to include in the request. hours: Hours to include in the request. - grain_method: + grain_method: Determines what temporal grains (ie annual, monthly, daily) + the user will accept if the grain the user requests is not + implemented for a requested dataset. Options include, "strict", + "skip", "any", "coarser", and "finer". subset_geom: A SubsetGeom representing the clipping region or points to use or None. target_crs: A CRS instance.