Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added implementation for mapl_GetPartition() with unit tests. Replaces logic that will disappear with MAPL2
- Added backwards compatibility with non-CF dimensionless vertical coordinate in ExtData2G

### Changed

Expand Down
23 changes: 23 additions & 0 deletions vertical/VerticalCoordinate.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ 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)
! allow backwards-compatibility with non-cf files
is_vertical_coord_var = is_vertical_coord_var .or. dim_name == 'lev'
if (is_vertical_coord_var) then
lev_name = dim_name
exit
Expand All @@ -103,6 +105,27 @@ 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 ( ((trim(standard_name) == "level" ) .or. &
(trim(standard_name) == "levels")) .and. &
((trim(temp_units) == "1" ) .or. &
(trim(temp_units) == "level")) ) then
Comment thread
lizziel marked this conversation as resolved.
Outdated
if (vertical_coord%levels(1) < vertical_coord%levels(2)) then
vertical_coord%positive = "up"
else
vertical_coord%positive = "down"
endif
Comment thread
lizziel marked this conversation as resolved.
Outdated
else
_ASSERT(.false.,'lev positive attribute not in file and no rule defined for setting it from standard_name and units')
Comment thread
lizziel marked this conversation as resolved.
Outdated
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
Expand Down
Loading