1 !------------------------------------------------------------------
3 !------------------------------------------------------------------
5 subroutine ext_pio_RealFieldIO(whole,IO,DH,Starts,Counts,fldsize,datasize,Data,Status)
11 include 'wrf_status_codes.h'
12 logical ,intent(in) :: whole
13 character (*) ,intent(in) :: IO
14 type(wrf_data_handle) :: DH
15 integer,dimension(NVarDims) ,intent(in) :: Starts
16 integer,dimension(NVarDims) ,intent(in) :: Counts
17 integer ,intent(in) :: fldsize, datasize
18 real, dimension(1:fldsize) ,intent(inout) :: Data
19 integer ,intent(out) :: Status
21 real, parameter :: fillvalue = 9.96921e+36
23 if(IO == 'write') then
25 stat = pio_put_var(DH%file_handle,DH%descVar(DH%CurrentVariable), &
26 Starts,Counts,Data(1:datasize))
28 call pio_write_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
29 DH%ioVar(DH%CurrentVariable), Data, stat, fillvalue)
33 stat = pio_get_var(DH%file_handle,DH%descVar(DH%CurrentVariable),Data(1:datasize))
35 call pio_read_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
36 DH%ioVar(DH%CurrentVariable), Data, stat)
39 call netcdf_err(stat,Status)
40 if(Status /= WRF_NO_ERR) then
41 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
42 call wrf_debug ( WARN , msg)
46 end subroutine ext_pio_RealFieldIO
48 subroutine ext_pio_DoubleFieldIO(whole,IO,DH,Starts,Counts,fldsize,datasize,Data,Status)
54 include 'wrf_status_codes.h'
55 logical ,intent(in) :: whole
56 character (*) ,intent(in) :: IO
57 type(wrf_data_handle) ,pointer :: DH
58 integer,dimension(NVarDims) ,intent(in) :: Starts
59 integer,dimension(NVarDims) ,intent(in) :: Counts
60 integer ,intent(in) :: fldsize, datasize
61 real*8,dimension(1:fldsize), intent(inout) :: Data
62 integer ,intent(out) :: Status
65 if(IO == 'write') then
67 stat = pio_put_var(DH%file_handle,DH%descVar(DH%CurrentVariable), &
68 Starts,Counts,Data(1:datasize))
70 call pio_write_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
71 DH%ioVar(DH%CurrentVariable), Data, stat)
75 stat = pio_get_var(DH%file_handle,DH%descVar(DH%CurrentVariable),Data)
77 call pio_read_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
78 DH%ioVar(DH%CurrentVariable), Data, stat)
81 call netcdf_err(stat,Status)
82 if(Status /= WRF_NO_ERR) then
83 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
84 call wrf_debug ( WARN , msg)
87 end subroutine ext_pio_DoubleFieldIO
89 subroutine ext_pio_IntFieldIO(whole,IO,DH,Starts,Counts,fldsize,datasize,Data,Status)
95 include 'wrf_status_codes.h'
96 logical ,intent(in) :: whole
97 character (*) ,intent(in) :: IO
98 type(wrf_data_handle) ,pointer :: DH
99 integer,dimension(NVarDims) ,intent(in) :: Starts
100 integer,dimension(NVarDims) ,intent(in) :: Counts
101 integer ,intent(in) :: fldsize, datasize
102 integer,dimension(1:fldsize),intent(inout) :: Data
103 integer ,intent(out) :: Status
105 integer, parameter :: fillvalue = 20140822
108 !call pio_setdebuglevel(1)
110 if(IO == 'write') then
112 stat = pio_put_var(DH%file_handle,DH%descVar(DH%CurrentVariable), &
113 Starts,Counts,Data(1:datasize))
115 call pio_write_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
116 DH%ioVar(DH%CurrentVariable), Data, stat, fillvalue)
120 if(1 == fldsize) then
121 stat = pio_get_var(DH%file_handle,DH%descVar(DH%CurrentVariable),Buffer)
124 stat = pio_get_var(DH%file_handle,DH%descVar(DH%CurrentVariable),Data)
127 call pio_read_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
128 DH%ioVar(DH%CurrentVariable), Data, stat)
131 call netcdf_err(stat,Status)
132 if(Status /= WRF_NO_ERR) then
133 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
134 call wrf_debug ( WARN , msg)
137 end subroutine ext_pio_IntFieldIO
139 subroutine ext_pio_LogicalFieldIO(whole,IO,DH,Starts,Counts,fldsize,datasize,Data,Status)
145 include 'wrf_status_codes.h'
146 logical ,intent(in) :: whole
147 character (*) ,intent(in) :: IO
148 type(wrf_data_handle) ,pointer :: DH
149 integer,dimension(NVarDims) ,intent(in) :: Starts
150 integer,dimension(NVarDims) ,intent(in) :: Counts
151 integer ,intent(in) :: fldsize, datasize
152 logical,dimension(1:fldsize),intent(inout) :: Data
153 integer ,intent(out) :: Status
154 integer,dimension(1:fldsize) :: Buffer
158 if(IO == 'write') then
167 stat = pio_put_var(DH%file_handle,DH%descVar(DH%CurrentVariable), &
168 Starts,Counts,Buffer(1:datasize))
170 call pio_write_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
171 DH%ioVar(DH%CurrentVariable), Buffer, stat)
175 stat = pio_get_var(DH%file_handle,DH%descVar(DH%CurrentVariable),Buffer)
177 call pio_read_darray(DH%file_handle, DH%descVar(DH%CurrentVariable), &
178 DH%ioVar(DH%CurrentVariable), Buffer, stat)
182 call netcdf_err(stat,Status)
183 if(Status /= WRF_NO_ERR) then
184 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
185 call wrf_debug ( WARN , msg)
189 end subroutine ext_pio_LogicalFieldIO