Skip to content

Commit

Permalink
Merge pull request #1373 from GEOS-ESM/merge/mathomp4/handmerge-main-…
Browse files Browse the repository at this point in the history
…into-develop-MAPL-2022Feb16

GitFlow: Handmerge main into develop 2022-Feb-16
  • Loading branch information
mathomp4 authored Feb 16, 2022
2 parents fbed639 + b0f9a8f commit b05beb8
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 32 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated

## [2.17.2] - 2022-02-16

### Fixed

- Fixes for Global Attributes to match FP 5.27
- Changed `lev` variable `standard_name` to `model_layers`
- Changed global attribute `Convention` to `Conventions`
- Fill `Source` with a string "<EXPSRC> experiment_id: <EXPID>" where EXPSRC and EXPID are from the `EXPSRC:` and `EXPID:` lines in HISTORY.rc

## [2.17.1] - 2022-02-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy (SET CMP0054 NEW)

project (
MAPL
VERSION 2.17.1
VERSION 2.17.2
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

# Set the default build type to release
Expand Down
2 changes: 1 addition & 1 deletion Tests/pfio_MAPL_demo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ program main
rc = status)

! Set File attributes
call fmd%add_attribute('Convention', 'COARDS')
call fmd%add_attribute('Conventions', 'COARDS')
call fmd%add_attribute('Source', 'GMAO')
call fmd%add_attribute('Title', 'Sample code to test PFIO')
call fmd%add_attribute('HISTORY', 'File writtem by PFIO vx.x.x')
Expand Down
40 changes: 20 additions & 20 deletions base/MAPL_VerticalMethods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module MAPL_VerticalDataMod
use, intrinsic :: ISO_C_BINDING
use, intrinsic :: iso_fortran_env, only: REAL64
implicit none

private

public :: VERTICAL_METHOD_NONE
Expand Down Expand Up @@ -56,7 +56,7 @@ module MAPL_VerticalDataMod
end interface

contains

function newVerticalData(levels,vcoord,vscale,vunit,positive,rc) result(vdata)
type(VerticalData) :: vData
real, pointer, intent(in), optional :: levels(:)
Expand All @@ -65,14 +65,14 @@ function newVerticalData(levels,vcoord,vscale,vunit,positive,rc) result(vdata)
character(len=*), optional, intent(in) :: vunit
character(len=*), optional, intent(in) :: positive
integer, optional, intent(Out) :: rc


if (present(positive)) then
_ASSERT(trim(positive)=='up'.or.trim(positive)=='down',trim(positive)//" not allowed for positive argument")
vdata%positive=trim(positive)
else
vdata%positive='down'
end if
end if

if (.not.present(levels)) then
if (trim(vdata%positive)=='down') then
Expand Down Expand Up @@ -109,7 +109,7 @@ function newVerticalData(levels,vcoord,vscale,vunit,positive,rc) result(vdata)
else
vdata%interp_levels = vdata%scaled_levels
endif
else
else
vdata%regrid_type = VERTICAL_METHOD_SELECT
end if
end function newVerticalData
Expand Down Expand Up @@ -166,7 +166,7 @@ subroutine setup_eta_to_pressure(this,regrid_handle,output_grid,rc)
this%pl3d = ( 0.5*(ptr3(:,:,1:)+ptr3(:,:,0:ubound(ptr3,3)-1)) )
end if
orig_surface_level = ptr3(:,:,ubound(ptr3,3))
this%ascending = (ptr3(1,1,0)<ptr3(1,1,1))
this%ascending = (ptr3(1,1,0)<ptr3(1,1,1))
else

! the ptr3 interpolating variable is a (1-lm) mid-layer variable
Expand Down Expand Up @@ -201,7 +201,7 @@ subroutine setup_eta_to_pressure(this,regrid_handle,output_grid,rc)
_ASSERT(present(regrid_handle),"Must provide regridding handle")
call MAPL_GridGet(output_grid,localCellCountPerDim=counts,rc=status)
_VERIFY(status)
if (.not.allocated(this%surface_level)) then
if (.not.allocated(this%surface_level)) then
allocate(this%surface_level(counts(1),counts(2)),stat=status)
_VERIFY(status)
end if
Expand Down Expand Up @@ -241,15 +241,15 @@ subroutine flip_levels(this,ptrin,ptrout,rc)
integer :: km

_ASSERT(all(shape(ptrin)==shape(ptrout)),"array must match shape to flip")

km = size(ptrin,3)

ptrout(:,:,1:km)=ptrin(:,:,km:1:-1)
_RETURN(_SUCCESS)

end subroutine flip_levels

subroutine correct_topo(this,field,rc)
subroutine correct_topo(this,field,rc)
class(verticalData), intent(inout) :: this
type(ESMF_Field), intent(inout) :: field
integer, optional, intent(out) :: rc
Expand Down Expand Up @@ -286,7 +286,7 @@ subroutine regrid_select_level(this,ptrIn,PtrOut,rc)
integer :: i

do i=1,size(this%levs)
ptrOut(:,:,i)=ptrIn(:,:,nint(this%levs(i)))
ptrOut(:,:,i)=ptrIn(:,:,nint(this%levs(i)))
enddo
_RETURN(ESMF_SUCCESS)

Expand Down Expand Up @@ -316,16 +316,16 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
type(ESMF_Field) :: field
real, pointer :: ptr3d(:,:,:)
logical :: haveVert

logical, allocatable :: HasUngrid(:)
character(len=ESMF_MAXSTR), allocatable :: ungridded_units(:)
character(len=ESMF_MAXSTR), allocatable :: ungridded_names(:)
character(len=ESMF_MAXSTR), allocatable :: ungridded_names(:)
character(len=ESMF_MAXSTR) :: ungridded_unit, ungridded_name
integer :: ungrdsize
real, allocatable :: ungridded_coord(:)
real, allocatable :: ungridded_coords(:,:)
logical :: unGrdNameCheck, unGrdUnitCheck, unGrdCoordCheck, have_ungrd, found_mixed_ce

integer :: status
type(Variable) :: v
logical :: isPresent
Expand Down Expand Up @@ -425,7 +425,7 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
vlb = 0
else
vlb = 1
end if
end if
end if

if (this%regrid_type == VERTICAL_METHOD_ETA2LEV) then
Expand All @@ -443,7 +443,7 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
if (this%regrid_type == VERTICAL_METHOD_NONE) then
_ASSERT(.not.(found_mixed_ce),'have mixed level/edge')
end if


if (haveVert) then
this%lm=lm
Expand All @@ -458,7 +458,7 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
if (allocated(ungridded_coord)) then
this%levs=ungridded_coord
end if

call metadata%add_dimension('lev', lm, rc=status)
v = Variable(type=PFIO_REAL64, dimensions='lev')
call v%add_attribute('units',ungridded_unit)
Expand All @@ -467,14 +467,14 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
call v%add_const_value(UnlimitedEntity(this%levs))
call metadata%add_variable('lev',v,rc=status)
_VERIFY(status)
else
else
call metadata%add_dimension('lev', lm, rc=status)
v = Variable(type=PFIO_REAL64, dimensions='lev')
call v%add_attribute('long_name','vertical level')
call v%add_attribute('units','layer')
call v%add_attribute('positive',trim(this%positive))
call v%add_attribute('coordinate','eta')
call v%add_attribute('standard_name','model_layer')
call v%add_attribute('standard_name','model_layers')
call v%add_const_value(UnlimitedEntity(this%levs))
call metadata%add_variable('lev',v,rc=status)
_VERIFY(status)
Expand Down Expand Up @@ -503,7 +503,7 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
call v%add_attribute('units','layer')
call v%add_attribute('positive','down')
call v%add_attribute('coordinate','eta')
call v%add_attribute('standard_name','model_layer')
call v%add_attribute('standard_name','model_layers')
call v%add_const_value(UnlimitedEntity(this%levs))
call metadata%add_variable('lev',v,rc=status)
_VERIFY(status)
Expand Down
4 changes: 2 additions & 2 deletions gridcomps/History/MAPL_HistoryCollection.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module MAPL_HistoryCollectionMod
character(len=ESMF_MAXSTR) :: descr
character(len=ESMF_MAXSTR) :: comment
character(len=ESMF_MAXSTR) :: contact
character(len=ESMF_MAXSTR) :: convention
character(len=ESMF_MAXSTR) :: conventions
character(len=ESMF_MAXSTR) :: institution
character(len=ESMF_MAXSTR) :: references
character(len=ESMF_MAXSTR) :: source
Expand Down Expand Up @@ -120,7 +120,7 @@ function define_collection_attributes(this,rc) result(global_attributes)
call global_attributes%insert("History","File written by MAPL_PFIO")
call global_attributes%insert("Source",trim(this%source))
call global_attributes%insert("Contact",trim(this%contact))
call global_attributes%insert("Convention",trim(this%convention))
call global_attributes%insert("Conventions",trim(this%conventions))
call global_attributes%insert("Institution",trim(this%institution))
call global_attributes%insert("References",trim(this%references))
call global_attributes%insert("Filename",trim(this%filename))
Expand Down
17 changes: 9 additions & 8 deletions gridcomps/History/MAPL_HistoryGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
! Defaults to "NetCDF-4". Can be globally set for all collections with "COMMENT:"
! \item[contact] Character string defining a contact.
! Defaults to "http://gmao.gsfc.nasa.gov". Can be globally set for all collections with "CONTACT:"
! \item[convention] Character string defining the convention.
! Defaults to "CF". Can be globally set for all collections with "CONVENTION:"
! \item[conventions] Character string defining the conventions.
! Defaults to "CF". Can be globally set for all collections with "CONVENTIONS:"
! \item[institution] Character string defining an institution.
! Defaults to "NASA Global Modeling and Assimilation Office". Can be globally set for all collections with "INSTITUTION:"
! \item[references] Character string defining references.
Expand Down Expand Up @@ -512,10 +512,11 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
label ='CONTACT:', default='http://gmao.gsfc.nasa.gov', _RC)
call ESMF_ConfigGetAttribute ( config, value=INTSTATE%global_atts%comment, &
label ='COMMENT:', default='NetCDF-4', _RC)
call ESMF_ConfigGetAttribute ( config, value=INTSTATE%global_atts%convention, &
label ='CONVENTION:', default='CF', _RC)
call ESMF_ConfigGetAttribute ( config, value=INTSTATE%global_atts%conventions, &
label ='CONVENTIONS:', default='CF', _RC)
call ESMF_ConfigGetAttribute ( config, value=INTSTATE%global_atts%source, &
label ='SOURCE:', default='unknown', _RC)
label ='SOURCE:', &
default=trim(INTSTATE%expsrc) // ' experiment_id: ' // trim(INTSTATE%expid), _RC)
call ESMF_ConfigGetAttribute ( config, value=INTSTATE%CoresPerNode, &
label ='CoresPerNode:', default=min(npes,8), rc=status )
_VERIFY(STATUS)
Expand Down Expand Up @@ -799,9 +800,9 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
call ESMF_ConfigGetAttribute ( cfg, value=list(n)%global_atts%contact, &
default=INTSTATE%global_atts%contact, &
label=trim(string) // 'contact:' ,_RC)
call ESMF_ConfigGetAttribute ( cfg, value=list(n)%global_atts%convention, &
default=INTSTATE%global_atts%convention, &
label=trim(string) // 'convention:' ,_RC)
call ESMF_ConfigGetAttribute ( cfg, value=list(n)%global_atts%conventions, &
default=INTSTATE%global_atts%conventions, &
label=trim(string) // 'conventions:' ,_RC)
call ESMF_ConfigGetAttribute ( cfg, value=list(n)%global_atts%institution, &
default=INTSTATE%global_atts%institution, &
label=trim(string) // 'institution:' ,_RC)
Expand Down

0 comments on commit b05beb8

Please sign in to comment.