ExtDataTypeDef.F90 Source File


This file depends on

sourcefile~~extdatatypedef.f90~~EfferentGraph sourcefile~extdatatypedef.f90 ExtDataTypeDef.F90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~extdatatypedef.f90->sourcefile~errorhandling.f90 sourcefile~extdataabstractfilehandler.f90 ExtDataAbstractFileHandler.F90 sourcefile~extdatatypedef.f90->sourcefile~extdataabstractfilehandler.f90 sourcefile~extdatabracket.f90 ExtDataBracket.F90 sourcefile~extdatatypedef.f90->sourcefile~extdatabracket.f90 sourcefile~extdatamasking.f90 ExtDataMasking.F90 sourcefile~extdatatypedef.f90->sourcefile~extdatamasking.f90 sourcefile~extdataupdatepointer.f90 ExtDataUpdatePointer.F90 sourcefile~extdatatypedef.f90->sourcefile~extdataupdatepointer.f90 sourcefile~filemetadatautilities.f90 FileMetadataUtilities.F90 sourcefile~extdatatypedef.f90->sourcefile~filemetadatautilities.f90 sourcefile~griddedioitem.f90 GriddedIOitem.F90 sourcefile~extdatatypedef.f90->sourcefile~griddedioitem.f90 sourcefile~mapl_newarthparser.f90 MAPL_NewArthParser.F90 sourcefile~extdatatypedef.f90->sourcefile~mapl_newarthparser.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~extdataabstractfilehandler.f90->sourcefile~extdatabracket.f90 sourcefile~extdataabstractfilehandler.f90->sourcefile~filemetadatautilities.f90 sourcefile~datacollection.f90 DataCollection.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~datacollection.f90 sourcefile~datacollectionmanager.f90 DataCollectionManager.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~datacollectionmanager.f90 sourcefile~extdataconstants.f90 ExtDataConstants.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~extdataconstants.f90 sourcefile~extdatafilestream.f90 ExtDataFileStream.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~extdatafilestream.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~stringtemplate.f90 StringTemplate.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~stringtemplate.f90 sourcefile~timestringconversion.f90 TimeStringConversion.F90 sourcefile~extdataabstractfilehandler.f90->sourcefile~timestringconversion.f90 sourcefile~base_base.f90 Base_Base.F90 sourcefile~extdatabracket.f90->sourcefile~base_base.f90 sourcefile~extdatabracket.f90->sourcefile~extdataconstants.f90 sourcefile~extdatanode.f90 ExtDataNode.F90 sourcefile~extdatabracket.f90->sourcefile~extdatanode.f90 sourcefile~fieldutils.f90 FieldUtils.F90 sourcefile~extdatabracket.f90->sourcefile~fieldutils.f90 sourcefile~extdatabracket.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_comms.f90 MAPL_Comms.F90 sourcefile~extdatabracket.f90->sourcefile~mapl_comms.f90 sourcefile~extdatabracket.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~extdatamasking.f90->sourcefile~mapl_newarthparser.f90 sourcefile~extdatamasking.f90->sourcefile~base_base.f90 sourcefile~constants.f90 Constants.F90 sourcefile~extdatamasking.f90->sourcefile~constants.f90 sourcefile~esmfl_mod.f90 ESMFL_Mod.F90 sourcefile~extdatamasking.f90->sourcefile~esmfl_mod.f90 sourcefile~extdatamasking.f90->sourcefile~keywordenforcer.f90 sourcefile~extdatamasking.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~extdataupdatepointer.f90->sourcefile~keywordenforcer.f90 sourcefile~extdataupdatepointer.f90->sourcefile~mapl_comms.f90 sourcefile~extdataupdatepointer.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~extdataupdatepointer.f90->sourcefile~timestringconversion.f90 sourcefile~filemetadatautilities.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_abstractgridfactory.f90 MAPL_AbstractGridFactory.F90 sourcefile~filemetadatautilities.f90->sourcefile~mapl_abstractgridfactory.f90 sourcefile~filemetadatautilities.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_gridmanager.f90 MAPL_GridManager.F90 sourcefile~filemetadatautilities.f90->sourcefile~mapl_gridmanager.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~filemetadatautilities.f90->sourcefile~pfio.f90 sourcefile~mapl_newarthparser.f90->sourcefile~base_base.f90 sourcefile~mapl_newarthparser.f90->sourcefile~fieldutils.f90 sourcefile~mapl_newarthparser.f90->sourcefile~mapl_comms.f90 sourcefile~mapl_newarthparser.f90->sourcefile~mapl_exceptionhandling.f90

Files dependent on this one

sourcefile~~extdatatypedef.f90~~AfferentGraph sourcefile~extdatatypedef.f90 ExtDataTypeDef.F90 sourcefile~extdataderivedexportvector.f90 ExtDataDerivedExportVector.F90 sourcefile~extdataderivedexportvector.f90->sourcefile~extdatatypedef.f90 sourcefile~extdatagridcompng.f90 ExtDataGridCompNG.F90 sourcefile~extdatagridcompng.f90->sourcefile~extdatatypedef.f90 sourcefile~extdatagridcompng.f90->sourcefile~extdataderivedexportvector.f90 sourcefile~extdataoldtypescreator.f90 ExtDataOldTypesCreator.F90 sourcefile~extdatagridcompng.f90->sourcefile~extdataoldtypescreator.f90 sourcefile~extdataprimaryexportvector.f90 ExtDataPrimaryExportVector.F90 sourcefile~extdatagridcompng.f90->sourcefile~extdataprimaryexportvector.f90 sourcefile~extdataoldtypescreator.f90->sourcefile~extdatatypedef.f90 sourcefile~extdataprimaryexportvector.f90->sourcefile~extdatatypedef.f90 sourcefile~extdatadrivergridcomp.f90 ExtDataDriverGridComp.F90 sourcefile~extdatadrivergridcomp.f90->sourcefile~extdatagridcompng.f90 sourcefile~mapl_capgridcomp.f90 MAPL_CapGridComp.F90 sourcefile~mapl_capgridcomp.f90->sourcefile~extdatagridcompng.f90 sourcefile~comp_testing_driver.f90 Comp_Testing_Driver.F90 sourcefile~comp_testing_driver.f90->sourcefile~mapl_capgridcomp.f90 sourcefile~extdatadriver.f90 ExtDataDriver.F90 sourcefile~extdatadriver.f90->sourcefile~extdatadrivergridcomp.f90 sourcefile~extdatadrivermod.f90 ExtDataDriverMod.F90 sourcefile~extdatadriver.f90->sourcefile~extdatadrivermod.f90 sourcefile~extdatadrivermod.f90->sourcefile~extdatadrivergridcomp.f90 sourcefile~mapl_cap.f90 MAPL_Cap.F90 sourcefile~mapl_cap.f90->sourcefile~mapl_capgridcomp.f90 sourcefile~mapl_gridcomps.f90 MAPL_GridComps.F90 sourcefile~mapl_gridcomps.f90->sourcefile~mapl_cap.f90 sourcefile~mapl_nuopcwrappermod.f90 MAPL_NUOPCWrapperMod.F90 sourcefile~mapl_nuopcwrappermod.f90->sourcefile~mapl_cap.f90

Source Code

#include "MAPL_Exceptions.h"
module MAPL_ExtDataTypeDef
   use ESMF
   use MAPL_GriddedIOItemMod
   use MAPL_ExtDataBracket
   use MAPL_ExtDataPointerUpdate
   use MAPL_ExtDataAbstractFileHandler
   use MAPL_FileMetadataUtilsMod
   use MAPL_NewArthParserMod
   use MAPL_ExtDataMask
   use mapl_ErrorHandlingMod
   implicit none

   public PrimaryExport
   public DerivedExport
   public BracketingFields

  integer, parameter         :: MAPL_ExtDataNullFrac      = -9999

  type BracketingFields
     ! fields to store endpoints for interpolation of a vector pair
     type(ExtDataBracket) :: comp1
     type(ExtDataBracket) :: comp2
     ! if vertically interpolating vector fields
     type(ExtDataBracket) :: auxiliary1
     type(ExtDataBracket) :: auxiliary2
     logical :: initialized = .false.
  end type BracketingFields

  type PrimaryExport
     character(len=ESMF_MAXSTR)   :: name
     character(len=ESMF_MAXSTR)   :: units=''
     integer                      :: Trans
     character(len=ESMF_MAXSTR)   :: var
     character(len=ESMF_MAXPATHLEN)   :: file_template ! remove

     logical                      :: isConst
     real                         :: Const !remove
     integer                      :: vartype ! MAPL_FieldItem or MAPL_BundleItem

     class(ExtDataAbstractFileHandler), allocatable :: filestream

     ! if primary export represents a pair of vector fields
     logical                      :: isVector
     type(BracketingFields)       :: modelGridFields

     ! names of the two vector components in the gridded component where import is declared
     character(len=ESMF_MAXSTR)   :: vcomp1, vcomp2
     ! the corresponding names of the two vector components on file
     character(len=ESMF_MAXSTR)   :: fcomp1, fcomp2
     type(GriddedIOitem)          :: fileVars

     integer                      :: pfioCollection_id
     integer                      :: iclient_collection_id

     logical                      :: ExtDataAlloc
     integer                      :: FracVal = MAPL_ExtDataNullFrac
     ! do we have to do vertical interpolation
     logical                      :: do_VertInterp = .false.
     logical                      :: do_Fill = .false.
     type(FileMetadataUtils)      :: file_metadata
     integer                      :: LM
     real, allocatable            :: levs(:)
     character(len=4)             :: importVDir = "down"
     character(len=4)             :: fileVDir = "down"
     character(len=ESMF_MAXSTR)   :: levUnit
     logical                      :: havePressure = .false.
     type(ExtDataPointerUpdate) :: update_freq

     ! new stuff
     logical                      :: cycling
     logical                      :: persist_closest
     type(ESMF_Time), allocatable :: source_time(:)

     ! for multiple collections
     type(ESMF_Time), allocatable :: start_end_time(:)
     logical :: initialized = .false.
     logical :: fail_on_missing_file = .true.
  end type PrimaryExport
  
  type DerivedExport
     character(len=ESMF_MAXSTR)     :: name
     character(len=ESMF_MAXPATHLEN) :: expression
     logical                        :: masking
     type(ExtDataMask), allocatable :: mask_definition 
     type(ExtDataPointerUpdate)     :: update_freq
     contains
        procedure :: evaluate_derived_field
  end type DerivedExport

  contains

      subroutine evaluate_derived_field(this,state,rc)
         class(DerivedExport), intent(inout) :: this
         type(ESMF_State), intent(inout) :: state
         integer, optional, intent(out) :: rc

         integer :: status
         type(ESMF_Field) :: field

         if (this%masking) then
            call this%mask_definition%evaluate_mask(state,trim(this%name),_RC)
         else
            call ESMF_StateGet(state,trim(this%name),field,_RC)
            call MAPL_StateEval(state,trim(this%expression),field,_RC)
         end if
         _RETURN(_SUCCESS)
      end subroutine

end module  MAPL_ExtDataTypeDef