diff --git a/src/Superstructure/State/doc/State_refdoc.ctex b/src/Superstructure/State/doc/State_refdoc.ctex index d9add4823e..3c83f42351 100644 --- a/src/Superstructure/State/doc/State_refdoc.ctex +++ b/src/Superstructure/State/doc/State_refdoc.ctex @@ -66,12 +66,10 @@ \input{State_usage} \input{ESMF_StateEx_fapi} \input{../../StateReconcile/doc/ESMF_StateReconcileEx_fapi} -\input{ESMF_StateReadWriteEx_fapi} #elif defined(CONSTITUENT) \input{../Superstructure/State/doc/State_usage} \input{../Superstructure/State/doc/ESMF_StateEx_fapi} \input{../Superstructure/StateReconcile/doc/ESMF_StateReconcileEx_fapi} -\input{../Superstructure/State/doc/ESMF_StateReadWriteEx_fapi} #endif \subsection{Restrictions and Future Work} diff --git a/src/Superstructure/State/examples/ESMF_StateReadWriteEx.F90 b/src/Superstructure/State/examples/ESMF_StateReadWriteEx.F90 deleted file mode 100644 index 0ce7774aae..0000000000 --- a/src/Superstructure/State/examples/ESMF_StateReadWriteEx.F90 +++ /dev/null @@ -1,198 +0,0 @@ -! $Id$ -! -! Earth System Modeling Framework -! Copyright (c) 2002-2024, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -! -!============================================================================== -! - program ESMF_StateReadWriteEx - -!------------------------------------------------------------------------------ -!ESMF_EXAMPLE String used by test script to count examples. -!------------------------------------------------------------------------- - -#include "ESMF.h" - -!BOE -!\subsubsection{Read Arrays from a NetCDF file and add to a State} -! \label{example:StateRdWr} -! This program shows an example of reading and writing Arrays from a State -! from/to a NetCDF file. -!EOE - -!----------------------------------------------------------------------------- - -!BOC - ! ESMF Framework module - use ESMF - use ESMF_TestMod - implicit none - - ! Local variables - type(ESMF_State) :: state - type(ESMF_Array) :: latArray, lonArray, timeArray, humidArray, & - tempArray, pArray, rhArray - type(ESMF_VM) :: vm - integer :: localPet, rc -!EOC - integer :: finalrc, result - character(ESMF_MAXSTR) :: testname - character(ESMF_MAXSTR) :: failMsg - -!------------------------------------------------------------------------- -!------------------------------------------------------------------------- - - write(failMsg, *) "Example failure" - write(testname, *) "Example ESMF_StateReadWriteEx" - - -! ------------------------------------------------------------------------------ -! ------------------------------------------------------------------------------ - - - finalrc = ESMF_SUCCESS - - call ESMF_Initialize(vm=vm, defaultlogfilename="StateReadWriteEx.Log", & - logkindflag=ESMF_LOGKIND_MULTI, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT) - call ESMF_VMGet(vm, localPet=localPet, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT) - - state = ESMF_StateCreate(name="Ocean Import", & - stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE - -!BOE -! The following line of code will read all Array data contained in a NetCDF -! file, place them in {\tt ESMF\_Arrays} and add them to an {\tt ESMF\_State}. -! Only PET 0 reads the file; the States in the other PETs remain empty. -! Currently, the data is not decomposed or distributed; each PET -! has only 1 DE and only PET 0 contains data after reading the file. -! Future versions of ESMF will support data decomposition and distribution -! upon reading a file. -! -! Note that the third party NetCDF library must be installed. For more -! details, see the "ESMF Users Guide", -! "Building and Installing the ESMF, Third Party Libraries, NetCDF" and -! the website http://www.unidata.ucar.edu/software/netcdf. -!EOE - -!BOC - ! Read the NetCDF data file into Array objects in the State on PET 0 - call ESMF_StateRead(state, "io_netcdf_testdata.nc", rc=rc) - - ! If the NetCDF library is not present (on PET 0), cleanup and exit - if (rc == ESMF_RC_LIB_NOT_PRESENT) then - call ESMF_StateDestroy(state, rc=rc) - goto 10 - endif -!EOC - if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE - -!BOE -! Only reading data into {\tt ESMF\_Arrays} is supported at this time; -! {\tt ESMF\_ArrayBundles}, {\tt ESMF\_Fields}, and {\tt ESMF\_FieldBundles} -! will be supported in future releases of ESMF. -!EOE - -!------------------------------------------------------------------------- -!BOE -!\subsubsection{Print Array data from a State} -! -! To see that the State now contains the same data as in the file, the -! following shows how to print out what Arrays are contained within the -! State and to print the data contained within each Array. The NetCDF utility -! "ncdump" can be used to view the contents of the NetCDF file. -! In this example, only PET 0 will contain data. -!EOE - -!BOC - if (localPet == 0) then - ! Print the names and attributes of Array objects contained in the State - call ESMF_StatePrint(state, rc=rc) - - ! Get each Array by name from the State - call ESMF_StateGet(state, "lat", latArray, rc=rc) - call ESMF_StateGet(state, "lon", lonArray, rc=rc) - call ESMF_StateGet(state, "time", timeArray, rc=rc) - call ESMF_StateGet(state, "Q", humidArray, rc=rc) - call ESMF_StateGet(state, "TEMP", tempArray, rc=rc) - call ESMF_StateGet(state, "p", pArray, rc=rc) - call ESMF_StateGet(state, "rh", rhArray, rc=rc) - - ! Print out the Array data - call ESMF_ArrayPrint(latArray, rc=rc) - call ESMF_ArrayPrint(lonArray, rc=rc) - call ESMF_ArrayPrint(timeArray, rc=rc) - call ESMF_ArrayPrint(humidArray, rc=rc) - call ESMF_ArrayPrint(tempArray, rc=rc) - call ESMF_ArrayPrint(pArray, rc=rc) - call ESMF_ArrayPrint(rhArray, rc=rc) - endif -!EOC - if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE - -!BOE -! Note that the Arrays "lat", "lon", and "time" hold spatial and temporal -! coordinate data for the dimensions latitude, longitude and time, -! respectively. These will be used in future releases of ESMF to create -! {\tt ESMF\_Grids}. -!EOE - -!------------------------------------------------------------------------- -!BOE -!\subsubsection{Write Array data within a State to a NetCDF file} -! -! All the Array data within the State on PET 0 can be written out to a NetCDF -! file as follows: -!EOE - -!BOC - ! Write Arrays within the State on PET 0 to a NetCDF file - call ESMF_StateWrite(state, "io_netcdf_testdata_out.nc", rc=rc) -!EOC - if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE - -!BOE -! Currently writing is limited to PET 0; future versions of ESMF will allow -! parallel writing, as well as parallel reading. -!EOE - - ! Destroy the State container - call ESMF_StateDestroy(state, rc=rc) - - if (localPet == 0) then - ! Destroy the constituent Arrays - call ESMF_ArrayDestroy(latArray, rc=rc) - call ESMF_ArrayDestroy(lonArray, rc=rc) - call ESMF_ArrayDestroy(timeArray, rc=rc) - call ESMF_ArrayDestroy(humidArray, rc=rc) - call ESMF_ArrayDestroy(tempArray, rc=rc) - call ESMF_ArrayDestroy(pArray, rc=rc) - call ESMF_ArrayDestroy(rhArray, rc=rc) - endif - if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE - - 10 continue ! Exit point if NetCDF not present (PET 0) - - ! IMPORTANT: ESMF_STest() prints the PASS string and the # of processors in the log - ! file that the scripts grep for. - call ESMF_STest((finalrc.eq.ESMF_SUCCESS), testname, failMsg, result, ESMF_SRCLINE) - - - call ESMF_Finalize(rc=rc) - if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE - - if (finalrc.EQ.ESMF_SUCCESS) then - print *, "PASS: ESMF_StateReadWriteEx.F90" - else - print *, "FAIL: ESMF_StateReadWriteEx.F90" - end if - - end program ESMF_StateReadWriteEx - diff --git a/src/Superstructure/State/examples/makefile b/src/Superstructure/State/examples/makefile index 3e71583422..60217754db 100644 --- a/src/Superstructure/State/examples/makefile +++ b/src/Superstructure/State/examples/makefile @@ -7,14 +7,13 @@ run_uni: run_examples_uni LOCDIR = src/Superstructure/State/examples .NOTPARALLEL: -EXAMPLES_BUILD = $(ESMF_EXDIR)/ESMF_StateEx \ - $(ESMF_EXDIR)/ESMF_StateReadWriteEx +EXAMPLES_BUILD = $(ESMF_EXDIR)/ESMF_StateEx -EXAMPLES_RUN = run_ESMF_StateEx \ - run_ESMF_StateReadWriteEx -EXAMPLES_RUN_UNI = run_ESMF_StateEx_uni \ - run_ESMF_StateReadWriteEx_uni +EXAMPLES_RUN = run_ESMF_StateEx + +EXAMPLES_RUN_UNI = run_ESMF_StateEx_uni + include $(ESMF_DIR)/makefile @@ -34,14 +33,3 @@ run_ESMF_StateEx: run_ESMF_StateEx_uni: $(MAKE) EXNAME=State NP=1 exfrun -# -# ESMF_StateReadWriteEx -# -run_ESMF_StateReadWriteEx: - cp -f $(ESMF_DIR)/src/Infrastructure/IO/tests/io_netcdf_testdata.nc $(ESMF_EXDIR) - $(MAKE) EXNAME=StateReadWrite NP=4 exfrun - -run_ESMF_StateReadWriteEx_uni: - cp -f $(ESMF_DIR)/src/Infrastructure/IO/tests/io_netcdf_testdata.nc $(ESMF_EXDIR) - $(MAKE) EXNAME=StateReadWrite NP=1 exfrun - diff --git a/src/Superstructure/State/src/ESMF_State.F90 b/src/Superstructure/State/src/ESMF_State.F90 index a1c5c159fc..8d72c0c59c 100644 --- a/src/Superstructure/State/src/ESMF_State.F90 +++ b/src/Superstructure/State/src/ESMF_State.F90 @@ -69,18 +69,21 @@ module ESMF_StateMod public ESMF_StateRemove public ESMF_StateReplace - - public ESMF_StateWriteRestart - public ESMF_StateReadRestart - - public ESMF_StateRead - public ESMF_StateWrite public ESMF_StatePrint public ESMF_StateSet public ESMF_StateSerialize, ESMF_StateDeserialize public ESMF_StateClassFindData + + ! These methods are broken and create Arrays in a bad configuration. + ! We are taking them out so no one uses them. Eventually, new correct + ! versions will be implemented. + ! public ESMF_StateRead + ! public ESMF_StateWrite + ! public ESMF_StateWriteRestart + ! public ESMF_StateReadRestart + !EOPI diff --git a/src/Superstructure/State/src/ESMF_StateAPI.cppF90 b/src/Superstructure/State/src/ESMF_StateAPI.cppF90 index 7a7dd1c9e1..7f5de0e04e 100644 --- a/src/Superstructure/State/src/ESMF_StateAPI.cppF90 +++ b/src/Superstructure/State/src/ESMF_StateAPI.cppF90 @@ -87,12 +87,6 @@ module ESMF_StateAPIMod public ESMF_StateIsReconcileNeeded public ESMF_StateLog - - public ESMF_StateWriteRestart - public ESMF_StateReadRestart - - public ESMF_StateRead - public ESMF_StateWrite public ESMF_StatePrint public ESMF_StateSet @@ -100,6 +94,15 @@ module ESMF_StateAPIMod public ESMF_StateClassFindData + ! These methods are broken and create Arrays in a bad configuration. + ! We are taking them out so no one uses them. Eventually, new correct + ! versions will be implemented. + ! public ESMF_StateRead + ! public ESMF_StateWrite + ! public ESMF_StateWriteRestart + ! public ESMF_StateReadRestart + + !EOPI !------------------------------------------------------------------------------ @@ -2334,7 +2337,7 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below !------------------------------------------------------------------------------ ^undef ESMF_METHOD ^define ESMF_METHOD "ESMF_StateRead" -!BOP +!BOPI ! !IROUTINE: ESMF_StateRead -- Read data items from a file into a State ! ! !INTERFACE: @@ -2375,7 +2378,7 @@ type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below ! not present. ! \end{description} ! -!EOP +!EOPI ! TODO: use item flag ESMF_STATEITEM_ARRAY integer :: localrc diff --git a/src/Superstructure/State/src/ESMF_StateWr.F90 b/src/Superstructure/State/src/ESMF_StateWr.F90 index 75c1d3a9b9..0814f07fcf 100644 --- a/src/Superstructure/State/src/ESMF_StateWr.F90 +++ b/src/Superstructure/State/src/ESMF_StateWr.F90 @@ -48,8 +48,12 @@ module ESMF_StateWrMod !------------------------------------------------------------------------------ ! !PUBLIC MEMBER FUNCTIONS: - public :: ESMF_StateWrite - public :: ESMF_StateWriteRestart + + ! These methods are broken and create Arrays in a bad configuration. + ! We are taking them out so no one uses them. Eventually, new correct + ! versions will be implemented. + ! public :: ESMF_StateWrite + ! public :: ESMF_StateWriteRestart !EOPI @@ -123,7 +127,7 @@ module ESMF_StateWrMod !------------------------------------------------------------------------------ #undef ESMF_METHOD #define ESMF_METHOD "ESMF_StateWrite" -!BOP +!BOPI ! !IROUTINE: ESMF_StateWrite -- Write items from a State to file ! ! !INTERFACE: @@ -162,7 +166,7 @@ subroutine ESMF_StateWrite(state, fileName, rc) ! not present. ! \end{description} ! -!EOP +!EOPI ! TODO: use item flag ESMF_STATEITEM_ARRAY integer :: localrc diff --git a/src/Superstructure/State/tests/ESMF_StateReadWriteUTest.F90 b/src/Superstructure/State/tests/ESMF_StateReadWriteUTest.F90 deleted file mode 100644 index 10f48fc376..0000000000 --- a/src/Superstructure/State/tests/ESMF_StateReadWriteUTest.F90 +++ /dev/null @@ -1,345 +0,0 @@ -! $Id$ -! -! Earth System Modeling Framework -! Copyright (c) 2002-2024, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -! -!============================================================================== -! - -!------------------------------------------------------------------------------- - - program ESMF_StateReadWriteUTest - -!============================================================================== -! -#include "ESMF.h" -! -!BOP -! !PROGRAM: ESMF_StateReadWriteUTest - Test code which Reads/Writes States -! -! !DESCRIPTION: -! -! The code in this file drives F90 State Read/Write unit tests. -! -!----------------------------------------------------------------------------- -! !USES: - use ESMF_TestMod ! test methods - use ESMF - implicit none - -!------------------------------------------------------------------------------ -! The following line turns the CVS identifier string into a printable variable. - character(*), parameter :: version = & - '$Id$' -!------------------------------------------------------------------------------ - -! ! Local variables - type(ESMF_State) :: state - type(ESMF_Array) :: latArray, lonArray, timeArray, humidArray, & - tempArray, pArray, rhArray - type(ESMF_VM) :: vm - integer :: localPet - integer :: i - integer :: rc, localrc - logical :: have_netcdf - - character(*), parameter :: netcdf_file = 'io_netcdf_testdata.nc' - character(*), parameter :: netcdf_fileout = 'io_netcdf_testdata_out.nc' - - integer, parameter :: narrays = 7 - character(8), parameter :: arraynames(narrays) = (/ & - "lat ", "lon ", "time", & - "Q ", "TEMP", "p ", & - "rh " & - /) - type(ESMF_StateItem_Flag) :: itemtype - integer :: itemcount - logical :: passfail - - ! individual test failure messages - character(ESMF_MAXSTR) :: failMsg - character(ESMF_MAXSTR) :: name - - ! cumulative result: count failures; no failures equals "all pass" - integer :: result = 0 - -!------------------------------------------------------------------------------- -! The unit tests are divided into Sanity and Exhaustive. The Sanity tests are -! always run. When the environment variable, EXHAUSTIVE, is set to ON then -! the EXHAUSTIVE and sanity tests both run. If the EXHAUSTIVE variable is set -! to OFF, then only the sanity unit tests. -! Special strings (Non-exhaustive and exhaustive) have been -! added to allow a script to count the number and types of unit tests. -!------------------------------------------------------------------------------- - - - call ESMF_TestStart(ESMF_SRCLINE, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_VMGetGlobal(vm=vm, rc=rc) - call ESMF_VMGet (vm, localPet=localPet) - -#ifdef ESMF_TESTEXHAUSTIVE - !------------------------------------------------------------------------ - !EX_UTest - ! Test Creation of an empty export State - state = ESMF_StateCreate(name="Ocean Export", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Creating an empty export State Test" - call ESMF_Test((rc.eq.ESMF_SUCCESS), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test reading a with no file name specified - call ESMF_StateRead(state, filename=' ', rc=rc) - write(failMsg, *) "Did not return an error" - write(name, *) "Reading a file with no file name specified" - call ESMF_Test(rc /= ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test reading a netCDF file into Arrays in a State - call ESMF_StateRead(state, filename=netcdf_file, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS when reading: ", netcdf_file - write(name, *) "Reading netCDF file ", netcdf_file, " into Arrays in a State" - call ESMF_Test((rc == ESMF_SUCCESS .or. rc == ESMF_RC_LIB_NOT_PRESENT), & - name, failMsg, result, ESMF_SRCLINE) - - have_netcdf = rc /= ESMF_RC_LIB_NOT_PRESENT - !------------------------------------------------------------------------ - !EX_UTest - ! Test for number of State items read from the file. - call ESMF_StateGet (state, itemCount=itemcount, rc=localrc) - write(failMsg, *) "Incorrect number of items read from file" - write(name, *) "Checking read-in Array item count in a State test" - ! Current implementation reads data on PET 0 - if (localPet == 0) then - passfail = itemcount == narrays - else - passfail = itemcount == 0 - end if - call ESMF_Test((rc == ESMF_SUCCESS .and. passfail) .or. .not. have_netcdf, & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test for presense of State items read from the file. - if (localPet == 0) then - do, i=1, narrays - call ESMF_StateGet (state, itemname=arraynames(i), itemType=itemtype, rc=localrc) - if (localrc /= ESMF_SUCCESS) exit - if (itemtype /= ESMF_STATEITEM_ARRAY) then - localrc = ESMF_RC_NOT_FOUND - exit - end if - end do - rc = merge (ESMF_SUCCESS, localrc, i>narrays) - else - i = 1 - rc = ESMF_SUCCESS - end if - write(failMsg, *) "Could not find read-in Array: ", trim (arraynames(min (i, narrays))) - write(name, *) "Checking read-in Array names in a State test" - call ESMF_Test((rc == ESMF_SUCCESS .or. .not. have_netcdf), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test reconciling Arrays across all PETs in a VM - call ESMF_StateReconcile(state, vm=vm, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Reconciling Arrays across all PETs in a VM" - call ESMF_Test((rc.eq.ESMF_SUCCESS), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test writing Arrays with no file name specified - call ESMF_StateWrite(state, filename=' ', rc=rc) - write(failMsg, *) "Did not return an error" - write(name, *) "Writing a file with no file name" - call ESMF_Test(rc /= ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test writing Arrays in a State to a netCDF file - call ESMF_StateWrite(state, filename=netcdf_fileout, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Writing netCDF file ", netcdf_fileout, " from Arrays in a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_LIB_NOT_PRESENT), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - ! Get each Array by name from the State - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "lat", latArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'lat' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "lon", lonArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'lon' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "time", timeArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'time' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "Q", humidArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'Q' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "TEMP", tempArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'TEMP' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "p", pArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'p' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - !EX_UTest - ! Test getting an Array from a State - call ESMF_StateGet(state, "rh", rhArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Getting Array named 'rh' from a State" - if (have_netcdf) then - call ESMF_Test(rc == ESMF_SUCCESS, & - name, failMsg, result, ESMF_SRCLINE) - else - call ESMF_Test(rc == ESMF_RC_NOT_FOUND, & - name, failMsg, result, ESMF_SRCLINE) - end if - !------------------------------------------------------------------------ - ! Destroy the State - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying a State - call ESMF_StateDestroy(state, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - ! Destroy the constituent Arrays - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(latArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'lat' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(lonArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'lon' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(timeArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'time' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(humidArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'Q' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(tempArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'TEMP' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(pArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'p' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - !EX_UTest - ! Test destroying an Array - call ESMF_ArrayDestroy(rhArray, rc=rc) - write(failMsg, *) "Did not return ESMF_SUCCESS" - write(name, *) "Destroying Array named 'rh' from a State" - call ESMF_Test((rc.eq.ESMF_SUCCESS.or.rc.eq.ESMF_RC_OBJ_NOT_CREATED), & - name, failMsg, result, ESMF_SRCLINE) - !------------------------------------------------------------------------ - ! End of Exhaustive tests -#endif - - ! return number of failures to environment; 0 = success (all pass) - ! return result ! TODO: no way to do this in F90 ? - - call ESMF_TestEnd(ESMF_SRCLINE) - - end program ESMF_StateReadWriteUTest - -!------------------------------------------------------------------------- diff --git a/src/Superstructure/State/tests/makefile b/src/Superstructure/State/tests/makefile index 5633288009..bee6bf4bff 100644 --- a/src/Superstructure/State/tests/makefile +++ b/src/Superstructure/State/tests/makefile @@ -9,17 +9,14 @@ LOCDIR = src/Superstructure/State/tests .NOTPARALLEL: TESTS_BUILD = $(ESMF_TESTDIR)/ESMC_StateUTest \ $(ESMF_TESTDIR)/ESMF_StateCreateUTest \ - $(ESMF_TESTDIR)/ESMF_StateReadWriteUTest \ $(ESMF_TESTDIR)/ESMF_StateUTest TESTS_RUN = RUN_ESMC_StateUTest \ RUN_ESMF_StateCreateUTest \ - RUN_ESMF_StateReadWriteUTest \ RUN_ESMF_StateUTest TESTS_RUN_UNI = RUN_ESMC_StateUTestUNI \ RUN_ESMF_StateCreateUTestUNI \ - RUN_ESMF_StateReadWriteUTestUNI \ RUN_ESMF_StateUTestUNI @@ -62,15 +59,4 @@ RUN_ESMC_StateUTest: RUN_ESMC_StateUTestUNI: $(MAKE) TNAME=State NP=1 ctest -# -# State Read/Write Unit Test -# - -RUN_ESMF_StateReadWriteUTest: - cp -f $(ESMF_DIR)/src/Infrastructure/IO/tests/io_netcdf_testdata.nc $(ESMF_TESTDIR) - $(MAKE) TNAME=StateReadWrite NP=4 ftest - -RUN_ESMF_StateReadWriteUTestUNI: - cp -f $(ESMF_DIR)/src/Infrastructure/IO/tests/io_netcdf_testdata.nc $(ESMF_TESTDIR) - $(MAKE) TNAME=StateReadWrite NP=1 ftest