You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by nc...@apache.org on 2023/05/11 23:07:43 UTC

[incubator-sdap-in-situ-data-services] branch master updated: Treat -99999 to be at surface (#16)

This is an automated email from the ASF dual-hosted git repository.

nchung pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-in-situ-data-services.git


The following commit(s) were added to refs/heads/master by this push:
     new 806a6d5  Treat -99999 to be at surface (#16)
806a6d5 is described below

commit 806a6d5eaee9ea27415342fc0cde7c35649d8b4e
Author: Jason Min-Liang Kang <ja...@gmail.com>
AuthorDate: Thu May 11 16:07:37 2023 -0700

    Treat -99999 to be at surface (#16)
    
    * Treat -99999 to be at surface
    
    * Update changelog
    
    * Update changelog with SDAP ticket number
---
 CHANGELOG.md                                              |  1 +
 .../io_logic/parquet_query_condition_management_v4.py     | 15 +++++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18fadf2..b971674 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### Added
+- SDAP-462: Updated query logic so that depth -99999 is treated as surface (i.e. depth 0)
 - SDAP-463: Added capability to further partition parquet objects/files by platform
 ### Changed
 ### Deprecated
diff --git a/parquet_flask/io_logic/parquet_query_condition_management_v4.py b/parquet_flask/io_logic/parquet_query_condition_management_v4.py
index 4d55825..5136fc0 100644
--- a/parquet_flask/io_logic/parquet_query_condition_management_v4.py
+++ b/parquet_flask/io_logic/parquet_query_condition_management_v4.py
@@ -137,19 +137,22 @@ class ParquetQueryConditionManagementV4:
 
     def __check_depth(self):
         if self.__query_props.min_depth is None and self.__query_props.max_depth is None:
-            return None
+            return
         depth_conditions = []
+        include_subsurface = None
         if self.__query_props.min_depth is not None:
             LOGGER.debug(f'setting depth min condition: {self.__query_props.min_depth}')
             depth_conditions.append(f"{CDMSConstants.depth_col} >= {self.__query_props.min_depth}")
+            include_subsurface = True if self.__query_props.min_depth <= 0 else False
         if self.__query_props.max_depth is not None:
             LOGGER.debug(f'setting depth max condition: {self.__query_props.max_depth}')
             depth_conditions.append(f"{CDMSConstants.depth_col} <= {self.__query_props.max_depth}")
-        LOGGER.debug(f'has depth condition. adding missing depth condition')
-        if len(depth_conditions) == 1:
-            self.__conditions.append(f'({depth_conditions[0]} OR {CDMSConstants.depth_col} == {self.__missing_depth_value})')
-            return
-        self.__conditions.append(f"(({' AND '.join(depth_conditions) }) OR {CDMSConstants.depth_col} == {self.__missing_depth_value})")
+            if include_subsurface is None or include_subsurface is True:
+                include_subsurface = True if self.__query_props.max_depth >= 0 else False
+        append_conditions = f"({' AND '.join(depth_conditions) })"
+        if include_subsurface is True:
+            append_conditions = f"( {append_conditions} OR {CDMSConstants.depth_col} == {self.__missing_depth_value} )"
+        self.__conditions.append(append_conditions)
         return
 
     def __add_variables_filter(self):