1 !---------------------------------------------------------------------------
4 ! Author: Wei Huang huangwei@ucar.edu
7 !---------------------------------------------------------------------------
9 !---------------------------------------------------------------------------
16 integer , parameter :: FATAL = 0
17 integer , parameter :: WARN = 0
18 integer , parameter :: WrfDataHandleMax = 99
19 integer , parameter :: MaxDims = 1000 ! = NF_MAX_VARS
20 integer , parameter :: MaxVars = 3000
21 integer , parameter :: MaxTimes = 60000
22 integer , parameter :: DateStrLen = 19
23 integer , parameter :: VarNameLen = 31
24 integer , parameter :: NO_DIM = 0
25 integer , parameter :: NVarDims = 5
26 integer , parameter :: NMDVarDims = 2
27 integer , parameter :: NOT_LAND_SOIL_VAR= 0
28 integer , parameter :: LAND_CAT_VAR = 1
29 integer , parameter :: SOIL_CAT_VAR = 2
30 integer , parameter :: SOIL_LAYERS_VAR = 3
31 integer , parameter :: MDL_CPL_VAR = 4
32 integer , parameter :: ENSEMBLE_VAR = 5
33 integer , parameter :: BDY_VAR = 10
34 character (8) , parameter :: NO_NAME = 'NULL'
35 character (DateStrLen) , parameter :: ZeroDate = '0000-00-00-00:00:00'
37 #include "wrf_io_flags.h"
39 character (256) :: msg
40 logical :: WrfIOnotInitialized = .true.
42 type :: wrf_data_handle
43 character (255) :: FileName
47 character (5) :: TimesName
49 integer :: CurrentTime !Only used for read
50 integer :: NumberTimes !Only used for read
51 character (DateStrLen), dimension(MaxTimes) :: Times
52 integer , dimension(MaxDims) :: DimLengths
53 integer , dimension(MaxDims) :: DimIDs
54 character (31) , dimension(MaxDims) :: DimNames
56 character (9) :: DimUnlimName
57 integer , dimension(MaxVars) :: VarIDs
58 integer , dimension(NVarDims-1, MaxVars) :: VarDimLens
59 character (VarNameLen), dimension(MaxVars) :: VarNames
60 integer :: CurrentVariable
63 ! first_operation is set to .TRUE. when a new handle is allocated
64 ! or when open-for-write or open-for-read are committed. It is set
65 ! to .FALSE. when the first field is read or written.
66 logical :: first_operation
69 type (IOsystem_desc_t), pointer :: iosystem ! PIO type handle to hold PIO-specific information
70 ! about a file IO decomposition
71 type (File_desc_t) :: file_handle ! file handle for normal PIO variables
73 type (Var_desc_t) :: vtime
75 type (io_desc_t) :: iodesc3d_m_double, iodesc3d_u_double, iodesc3d_v_double, iodesc3d_w_double
76 type (io_desc_t) :: iodesc2d_m_double, iodesc2d_u_double, iodesc2d_v_double, iodesc2d_char_double
77 type (io_desc_t) :: iodesc3d_m_real, iodesc3d_u_real, iodesc3d_v_real, iodesc3d_w_real
78 type (io_desc_t) :: iodesc2d_m_real, iodesc2d_u_real, iodesc2d_v_real, iodesc2d_char_real
79 type (io_desc_t) :: iodesc3d_m_int, iodesc3d_u_int, iodesc3d_v_int, iodesc3d_w_int
80 type (io_desc_t) :: iodesc2d_m_int, iodesc2d_u_int, iodesc2d_v_int, iodesc2d_char_int
82 !type (io_desc_t) :: iodesc1d_double
83 !type (io_desc_t) :: iodesc1d_real
84 !type (io_desc_t) :: iodesc1d_int
86 type (io_desc_t) :: iodesc3d_land_double, iodesc3d_soil_double, iodesc3d_soil_layers_double
87 type (io_desc_t) :: iodesc3d_land_real, iodesc3d_soil_real, iodesc3d_soil_layers_real
88 type (io_desc_t) :: iodesc3d_land_int, iodesc3d_soil_int, iodesc3d_soil_layers_int
90 type (io_desc_t) :: iodesc3d_mdl_cpl_double
91 type (io_desc_t) :: iodesc3d_mdl_cpl_real
92 type (io_desc_t) :: iodesc3d_mdl_cpl_int
94 type (io_desc_t) :: iodesc3d_ensemble_double
95 type (io_desc_t) :: iodesc3d_ensemble_real
96 type (io_desc_t) :: iodesc3d_ensemble_int
98 type (io_desc_t) :: iodesc3d_xsz_u_real, iodesc3d_xsz_u_double, iodesc3d_xsz_u_int
99 type (io_desc_t) :: iodesc3d_xsz_v_real, iodesc3d_xsz_v_double, iodesc3d_xsz_v_int
100 type (io_desc_t) :: iodesc3d_xsz_w_real, iodesc3d_xsz_w_double, iodesc3d_xsz_w_int
101 type (io_desc_t) :: iodesc3d_xsz_m_real, iodesc3d_xsz_m_double, iodesc3d_xsz_m_int
103 type (io_desc_t) :: iodesc3d_xez_u_real, iodesc3d_xez_u_double, iodesc3d_xez_u_int
104 type (io_desc_t) :: iodesc3d_xez_v_real, iodesc3d_xez_v_double, iodesc3d_xez_v_int
105 type (io_desc_t) :: iodesc3d_xez_w_real, iodesc3d_xez_w_double, iodesc3d_xez_w_int
106 type (io_desc_t) :: iodesc3d_xez_m_real, iodesc3d_xez_m_double, iodesc3d_xez_m_int
108 type (io_desc_t) :: iodesc3d_ysz_u_real, iodesc3d_ysz_u_double, iodesc3d_ysz_u_int
109 type (io_desc_t) :: iodesc3d_ysz_v_real, iodesc3d_ysz_v_double, iodesc3d_ysz_v_int
110 type (io_desc_t) :: iodesc3d_ysz_w_real, iodesc3d_ysz_w_double, iodesc3d_ysz_w_int
111 type (io_desc_t) :: iodesc3d_ysz_m_real, iodesc3d_ysz_m_double, iodesc3d_ysz_m_int
113 type (io_desc_t) :: iodesc3d_yez_u_real, iodesc3d_yez_u_double, iodesc3d_yez_u_int
114 type (io_desc_t) :: iodesc3d_yez_v_real, iodesc3d_yez_v_double, iodesc3d_yez_v_int
115 type (io_desc_t) :: iodesc3d_yez_w_real, iodesc3d_yez_w_double, iodesc3d_yez_w_int
116 type (io_desc_t) :: iodesc3d_yez_m_real, iodesc3d_yez_m_double, iodesc3d_yez_m_int
118 type (io_desc_t) :: iodesc2d_xs_m_real, iodesc2d_xs_m_double, iodesc2d_xs_m_int
119 type (io_desc_t) :: iodesc2d_xe_m_real, iodesc2d_xe_m_double, iodesc2d_xe_m_int
120 type (io_desc_t) :: iodesc2d_ys_m_real, iodesc2d_ys_m_double, iodesc2d_ys_m_int
121 type (io_desc_t) :: iodesc2d_ye_m_real, iodesc2d_ye_m_double, iodesc2d_ye_m_int
123 type (Var_desc_t), dimension(MaxVars) :: descVar
124 type (io_desc_t), dimension(MaxVars) :: ioVar
125 integer, dimension(MaxVars) :: vartype
127 integer(i4) :: iostat ! PIO-specific io status
128 integer(i4) :: myrank, nprocs
129 integer(i4) :: pioprocs, piostart, piostride, pioshift
130 ! the 3D grid size used to write VDC data
131 end type wrf_data_handle
133 type(wrf_data_handle),target :: WrfDataHandles(WrfDataHandleMax)
135 end module wrf_data_pio