Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set lev positive 'up' for all collections except Emissions #10

Merged
merged 1 commit into from Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions base/MAPL_VerticalMethods.F90
Expand Up @@ -272,10 +272,11 @@ subroutine get_interpolating_variable(this,bundle,rc)
end subroutine get_interpolating_variable


subroutine append_vertical_metadata(this,metadata,bundle,rc)
subroutine append_vertical_metadata(this,metadata,bundle,posDown,rc)
class (verticalData), intent(inout) :: this
type(FileMetaData), intent(inout) :: metadata
type(ESMF_FieldBundle), intent(inout) :: bundle
logical, optional, intent(in) :: posDown ! Added for GCHP
integer, optional, intent(out) :: rc

integer :: lm,i,NumVars,fieldRank,vlast,vloc,vlb
Expand All @@ -297,6 +298,12 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
type(Variable) :: v
logical :: isPresent

logical :: isPosDown ! Added for GCHP

! Added for GCHP
isPosDown = .TRUE.
if (present(posDown)) isPosDown = posDown

! loop over variables in file
call ESMF_FieldBundleGet(bundle,fieldCount=NumVars,rc=status)
_VERIFY(status)
Expand Down Expand Up @@ -438,7 +445,11 @@ subroutine append_vertical_metadata(this,metadata,bundle,rc)
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','down')
if (isPosDown) then
call v%add_attribute('positive','down')
else
call v%add_attribute('positive','up')
endif
call v%add_attribute('coordinate','eta')
call v%add_attribute('standard_name','model_layer')
call v%add_const_value(UnlimitedEntity(this%levs))
Expand Down
10 changes: 8 additions & 2 deletions base/MAPL_newCFIO.F90
Expand Up @@ -99,13 +99,14 @@ function new_MAPL_newCFIO(metadata,input_bundle,output_bundle,write_collection_i
_RETURN(ESMF_SUCCESS)
end function new_MAPL_newCFIO

subroutine CreateFileMetaData(this,items,bundle,timeInfo,vdata,ogrid,rc)
subroutine CreateFileMetaData(this,items,bundle,timeInfo,vdata,ogrid,posDown,rc)
class (MAPL_newCFIO), intent(inout) :: this
type(newCFIOitemVector), target, intent(inout) :: items
type(ESMF_FieldBundle), intent(inout) :: bundle
type(TimeData), intent(inout) :: timeInfo
type(VerticalData), intent(inout), optional :: vdata
type (ESMF_Grid), intent(inout), pointer, optional :: ogrid
logical, intent(in), optional :: posDown ! Added for GCHP
integer, intent(out), optional :: rc

type(ESMF_Grid) :: input_grid
Expand All @@ -117,6 +118,11 @@ subroutine CreateFileMetaData(this,items,bundle,timeInfo,vdata,ogrid,rc)
integer :: metadataVarsSize

integer :: status
logical :: isPosDown ! Added for GCHP

! Added for GCHP
isPosDown = .TRUE.
if (present(posDown)) isPosDown = posDown

this%items = items
this%input_bundle = bundle
Expand Down Expand Up @@ -145,7 +151,7 @@ subroutine CreateFileMetaData(this,items,bundle,timeInfo,vdata,ogrid,rc)
this%vdata=VerticalData(rc=status)
_VERIFY(status)
end if
call this%vdata%append_vertical_metadata(this%metadata,this%input_bundle,rc=status)
call this%vdata%append_vertical_metadata(this%metadata,this%input_bundle,posDown=isPosDown,rc=status)
_VERIFY(status)
this%doVertRegrid = (this%vdata%regrid_type /= VERTICAL_METHOD_NONE)
if (this%vdata%regrid_type == VERTICAL_METHOD_ETA2LEV) call this%vdata%get_interpolating_variable(this%input_bundle,rc=status)
Expand Down
6 changes: 5 additions & 1 deletion gridcomps/History/MAPL_HistoryGridComp.F90
Expand Up @@ -409,6 +409,7 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
integer :: chnksz
logical :: table_end
logical :: old_fields_style
logical :: isPosDown ! Added for GCHP

type(HistoryCollection) :: collection
character(len=ESMF_MAXSTR) :: cFileOrder
Expand Down Expand Up @@ -2442,7 +2443,10 @@ subroutine Initialize ( gc, import, dumexport, clock, rc )
call list(n)%mNewCFIO%CreateFileMetaData(list(n)%items,list(n)%bundle,list(n)%timeInfo,ogrid=pgrid,vdata=list(n)%vdata,rc=status)
_VERIFY(status)
else
call list(n)%mNewCFIO%CreateFileMetaData(list(n)%items,list(n)%bundle,list(n)%timeInfo,vdata=list(n)%vdata,rc=status)
! Set lev positive to down for Emissions collection in GCHP
isPosDown = .TRUE.
if ( trim(list(n)%collection) /= "Emissions" ) isPosDown = .FALSE.
call list(n)%mNewCFIO%CreateFileMetaData(list(n)%items,list(n)%bundle,list(n)%timeInfo,vdata=list(n)%vdata,posDown=isPosDown,rc=status)
_VERIFY(status)
end if
collection_id = o_Clients%add_hist_collection(list(n)%mNewCFIO%metadata)
Expand Down