subroutine test_main() ! Initialize framework ! -------------------- call ESMF_Initialize (vm=vm, rc=status) _VERIFY(status) IamRoot = MAPL_am_I_root() ! Get the global vm ! ----------------- call ESMF_VMGetGlobal(vm, rc=status) _VERIFY(status) ! Create a grid ! ------------- grid = MyGridCreate_ ( vm, rc=status ) _VERIFY(status) ! Create empty bundles ! -------------------- fBundle = ESMF_BundleCreate ( name='Francesca', grid=grid, rc=status ) _VERIFY(status) dBundle = ESMF_BundleCreate ( name='Denise', grid=grid, rc=status ) _VERIFY(status) ! Set the time as the one on the hardwired file name ! -------------------------------------------------- call ESMF_CalendarSetDefault ( ESMF_CAL_GREGORIAN, rc=status ) _VERIFY(STATUS) call ESMF_TimeSet( fTime, yy=2002, mm=7, dd=15, h=12, m=0, s=0, rc=status ) _VERIFY(STATUS) call ESMF_TimeIntervalSet( fTimeStep, h=6, m=0, s=0, rc=status ) _VERIFY(STATUS) fClock = ESMF_ClockCreate ( name="Clovis", timeStep=fTimeStep, & startTime=fTime, rc=status ) _VERIFY(STATUS) ! Read Bundle from file on a clean slate ! -------------------------------------- if ( IamRoot ) print *, 'Reading ' // fFilename call ESMF_ioRead ( fFilename, fTime, fBundle, rc=status, & verbose=.true., force_regrid=.true. ) _VERIFY(status) ! Setup data types need for write ! ------------------------------- allocate ( resolution(2), levels(KM_WORLD), stat=status ) _VERIFY(status) resolution = (/ IM_WORLD/2, JM_WORLD/2 /) levels = (/ (k, k=1,KM_WORLD) /) ! Write the same bundle to a different file, each time with ! different precision ! ---------------------------------------------------------- nbits = 32 ! full precision write(fname,"('test.aero.eta.',I2.2)") nbits call ESMF_ioCreate ( cfio, fname, fClock, fBundle, fTimeStep, & resolution, levels, 'Bundle Write Test', rc=status ) _VERIFY(status) call ESMF_ioWrite ( cfio, fClock, fBundle, fTimeStep, levels, rc=status, & verbose = .true. ) ! omit nbits _VERIFY(status) call ESMF_ioDestroy ( cfio ) do nbits = 16, 8, -2 write(fname,"('test.aero.eta.',I2.2)") nbits call ESMF_ioCreate ( cfio, fname, fClock, fBundle, fTimeStep, & resolution, levels, 'Bundle Write Test', rc=status ) _VERIFY(status) call ESMF_ioWrite ( cfio, fClock, fBundle, fTimeStep, levels, rc=status, & nbits = nbits, verbose = .true. ) _VERIFY(status) call ESMF_ioDestroy ( cfio ) end do ! precision loop ! All done ! -------- call ESMF_Finalize ( rc=status ) _VERIFY(STATUS) end subroutine test_main