diff --git a/CHANGELOG.md b/CHANGELOG.md index 853a3b3fed2..e0c26468879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed compiler bug encountered with certain versions of Intel compilers +- Fixed bug when one of the two names in an ExtData2G rule for a vector is contained in a substring in another item, for example UA;VA and EVAP ### Added - Add debug logger call to print out the name of the container being read from `ExtData.rc` - Added dimensionless vertical coordinates to criteria for vertically flipping imports in ExtData +- Added ExtData2G criteria for presence of vertical coordinate for cases of non-CF-compliant files ### Changed +- Changed default ExtData2G import vertical direction from down to up ### Removed diff --git a/gridcomps/ExtData2G/ExtDataConfig.F90 b/gridcomps/ExtData2G/ExtDataConfig.F90 index bb925d60043..307f50d23cc 100644 --- a/gridcomps/ExtData2G/ExtDataConfig.F90 +++ b/gridcomps/ExtData2G/ExtDataConfig.F90 @@ -277,7 +277,7 @@ function get_item_type(this,item_name,unusable,rc) result(item_type) type(ExtDataRuleMapIterator) :: rule_iterator character(len=:), pointer :: key - character(len=:), allocatable :: found_key + character(len=:), allocatable :: found_key, stripped_name logical :: found_rule _UNUSED_DUMMY(unusable) @@ -287,7 +287,8 @@ function get_item_type(this,item_name,unusable,rc) result(item_type) rule_iterator = this%rule_map%begin() do while(rule_iterator /= this%rule_map%end()) key => rule_iterator%key() - if (index(key,trim(item_name))/=0) then + stripped_name = strip_multi_rule(key) + if (trim(stripped_name)==trim(item_name)) then found_rule = .true. found_key = key exit @@ -315,7 +316,22 @@ function get_item_type(this,item_name,unusable,rc) result(item_type) found_rule = .true. end if _RETURN(_SUCCESS) - end function get_item_type + + contains + function strip_multi_rule(full_name) result(stripped_name) + character(len=:), allocatable :: stripped_name + character(len=*), intent(in) :: full_name + + integer :: plus_sign + plus_sign = index(full_name,'+') + if (plus_sign == 0) then + stripped_name=full_name + else + stripped_name=full_name(:plus_sign-1) + end if + end function + + end function get_item_type subroutine add_new_rule(this,key,export_rule,multi_rule,rc) class(ExtDataConfig), intent(inout) :: this diff --git a/gridcomps/ExtData2G/ExtDataTypeDef.F90 b/gridcomps/ExtData2G/ExtDataTypeDef.F90 index fddb33e8e54..02f0e095173 100644 --- a/gridcomps/ExtData2G/ExtDataTypeDef.F90 +++ b/gridcomps/ExtData2G/ExtDataTypeDef.F90 @@ -73,7 +73,9 @@ module MAPL_ExtDataTypeDef type(ESMF_FieldBundle) :: t_interp_bundle - character(len=4) :: importVDir = "down" + ! Change default for GCHP + !character(len=4) :: importVDir = "down" + character(len=4) :: importVDir = "up" logical :: enable_vertical_regrid = .false. logical :: allow_vertical_regrid = .false. character(len=:), allocatable :: aux_ps, aux_q diff --git a/vertical/VerticalCoordinate.F90 b/vertical/VerticalCoordinate.F90 index af436e322e5..2af76290d61 100644 --- a/vertical/VerticalCoordinate.F90 +++ b/vertical/VerticalCoordinate.F90 @@ -79,6 +79,7 @@ function new_verticalCoordinate(metadata, var_name, rc) result(vertical_coord) if (metadata%has_variable(dim_name)) then dim_var => metadata%get_variable(dim_name) is_vertical_coord_var = detect_cf_vertical_coord_var(dim_var, _RC) + is_vertical_coord_var = is_vertical_coord_var .or. dim_name == 'lev' if (is_vertical_coord_var) then lev_name = dim_name exit @@ -103,6 +104,24 @@ function new_verticalCoordinate(metadata, var_name, rc) result(vertical_coord) if (vertical_coord%levels(1) > vertical_coord%levels(2)) vertical_coord%positive = "up" !bmaa _RETURN(_SUCCESS) end if + + ! now test if no positive attribute and does not have pressure units + ! for backwards compatibility with non-cf files + if ((.not. coord_var%is_attribute_present("positive")) .and. & + (.not. has_pressure_units)) then + standard_name = coord_var%get_attribute_string("standard_name") + ! metadata combinations that imply integer levels + if ( any(standard_name == ["level ", "levels"]) .and. & + any(temp_units == ["1 ", "level"])) then + vertical_coord%positive = "up" + if (vertical_coord%levels(1) >= vertical_coord%levels(2)) then + vertical_coord%positive = "down" + endif + else + _FAIL('lev positive attribute not in file and no rule defined for setting it from standard_name and units') + endif + endif + ! now test if this is a "fixed" height level, if has height units, then dimensioanl coordinate, but must have positive has_height_units = safe_are_convertible(temp_units, 'm', _RC) if (has_height_units) then