| 1 | program readmeteo |
|---|
| 2 | |
|---|
| 3 | implicit none |
|---|
| 4 | include "netcdf.inc" |
|---|
| 5 | |
|---|
| 6 | !------------------------------------------------------------------------! |
|---|
| 7 | ! Readmeteo prepares an initial state for the WPS pre-processor of WRF ! |
|---|
| 8 | ! ! |
|---|
| 9 | ! Input is a diagfi.nc NETCDF file from a LMD/GCM simulation ! |
|---|
| 10 | ! ! |
|---|
| 11 | ! Outputs are WRFSI intermediate format files ready for metgrid.exe ! |
|---|
| 12 | ! http://www.mmm.ucar.edu/wrf/OnLineTutorial/WPS/IM_si.htm ! |
|---|
| 13 | ! ! |
|---|
| 14 | ! A. Spiga - 16/04/2007 ! |
|---|
| 15 | ! 22/05/2007 : need to run zrecast as a preliminary ! |
|---|
| 16 | ! 07/06/2007 : external parameter file 'readmeteo.def ! |
|---|
| 17 | ! 30/07/2007 : manage additional variables (tsoil, emiss,...) ! |
|---|
| 18 | ! 19/10/2007 : no need to run zrecast at all (eta levels) ! |
|---|
| 19 | ! 12/2007 : include co2ice and emissivity ! |
|---|
| 20 | ! ! |
|---|
| 21 | ! spiga@lmd.jussieu.fr ! |
|---|
| 22 | !------------------------------------------------------------------------! |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | !*************************************************************************** |
|---|
| 27 | !*************************************************************************** |
|---|
| 28 | REAL, PARAMETER :: emiss_prescribed=0.95 |
|---|
| 29 | REAL, PARAMETER :: co2ice_prescribed=0. |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | !*************************************************************************** |
|---|
| 35 | !*************************************************************************** |
|---|
| 36 | |
|---|
| 37 | REAL :: ptop |
|---|
| 38 | REAL, PARAMETER :: grav=3.72 |
|---|
| 39 | LOGICAL, PARAMETER :: blank=.false. |
|---|
| 40 | CHARACTER (LEN=3), PARAMETER :: ident='LMD' |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | !! Variables to be written in the output file |
|---|
| 44 | !! *** NB: conformity with metgrid/src/read_met_module.F90 |
|---|
| 45 | CHARACTER (LEN=33) :: output |
|---|
| 46 | INTEGER :: IFV |
|---|
| 47 | CHARACTER (LEN=24) :: HDATE |
|---|
| 48 | REAL :: XFCST |
|---|
| 49 | CHARACTER (LEN=32) :: SOURCE |
|---|
| 50 | CHARACTER (LEN=9) :: FIELD |
|---|
| 51 | CHARACTER (LEN=25) :: UNITS |
|---|
| 52 | CHARACTER (LEN=46) :: DESC |
|---|
| 53 | REAL :: XLVL |
|---|
| 54 | INTEGER :: NX,NY,IPROJ |
|---|
| 55 | CHARACTER (LEN=8) :: STARTLOC |
|---|
| 56 | REAL :: STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 57 | REAL, POINTER, DIMENSION(:,:) :: SLAB |
|---|
| 58 | |
|---|
| 59 | !! Variables related to NETCDF format |
|---|
| 60 | integer :: nid,nid2,nvarid,ierr,ierr2 |
|---|
| 61 | integer :: timedim,londim,latdim,altdim,altdim2 |
|---|
| 62 | integer :: rlatvdim,rlonudim |
|---|
| 63 | integer :: timelen,lonlen,latlen,altlen,altlen2 |
|---|
| 64 | integer :: rlatvlen,rlonulen |
|---|
| 65 | integer :: soillen,soildim |
|---|
| 66 | integer, dimension(4) :: corner,edges |
|---|
| 67 | |
|---|
| 68 | !! Intermediate data arrays |
|---|
| 69 | integer :: k,l |
|---|
| 70 | real, dimension(:), allocatable :: lat,lon,time,alt,aps,bps,levels |
|---|
| 71 | real, dimension(:,:), allocatable :: vide,ones,ghtsfile |
|---|
| 72 | real, dimension(:,:,:), allocatable :: psfile,tsfile |
|---|
| 73 | real, dimension(:,:,:), allocatable :: emissfile,co2icefile |
|---|
| 74 | real, dimension(:,:,:), allocatable :: tnsfile,unsfile,vnsfile |
|---|
| 75 | real, dimension(:,:,:,:), allocatable :: tfile,ufile,vfile,rfile,hfile |
|---|
| 76 | real, dimension(:,:,:,:), allocatable :: eta_gcm |
|---|
| 77 | real, dimension(:,:,:,:), allocatable :: tfileorig,ufileorig,vfileorig |
|---|
| 78 | real, dimension(:,:,:,:), allocatable :: tsoilfile |
|---|
| 79 | |
|---|
| 80 | !! Reading the parameter file |
|---|
| 81 | integer :: tmp,increment,FILES |
|---|
| 82 | integer :: tmp2,tmp3,tmp4 |
|---|
| 83 | character*1 :: answer |
|---|
| 84 | character*4 :: str |
|---|
| 85 | character*2 :: str2, str3, str4 |
|---|
| 86 | integer, dimension(:), allocatable :: time_out |
|---|
| 87 | character*13, dimension(:), allocatable :: date_out |
|---|
| 88 | character*19, dimension(:), allocatable :: date_out2 |
|---|
| 89 | !*************************************************************************** |
|---|
| 90 | !*************************************************************************** |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | !!--------------------- |
|---|
| 94 | !! Open the datafile |
|---|
| 95 | !!--------------------- |
|---|
| 96 | ierr=NF_OPEN ("input_diagfi.nc",NF_NOWRITE,nid) |
|---|
| 97 | IF (ierr.NE.NF_NOERR) THEN |
|---|
| 98 | write(*,*)'**** Please create a symbolic link called input_diagfi.nc' |
|---|
| 99 | CALL ABORT |
|---|
| 100 | ENDIF |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | !!-------------------------- |
|---|
| 104 | !! Ask for data references |
|---|
| 105 | !!-------------------------- |
|---|
| 106 | write(*,*) "Create n files. What is n ?" |
|---|
| 107 | read(*,*) FILES |
|---|
| 108 | allocate(time_out(FILES)) |
|---|
| 109 | allocate(date_out(FILES)) |
|---|
| 110 | allocate(date_out2(FILES)) |
|---|
| 111 | |
|---|
| 112 | write(*,*) "" |
|---|
| 113 | write(*,*) "INPUT: Diagfi time" |
|---|
| 114 | write(*,*) "list of n subscripts, separated by <Return>s" |
|---|
| 115 | increment=1 |
|---|
| 116 | do while (increment.ne.FILES+1) |
|---|
| 117 | read(*,*) tmp |
|---|
| 118 | time_out(increment)=tmp |
|---|
| 119 | increment=increment+1 |
|---|
| 120 | enddo |
|---|
| 121 | |
|---|
| 122 | write(*,*) "" |
|---|
| 123 | write(*,*) "OUTPUT: WRF time" |
|---|
| 124 | write(*,*) "fill 4 lines indicating" |
|---|
| 125 | write(*,*) "-year (4 digits)" |
|---|
| 126 | write(*,*) "-month (2 digits)" |
|---|
| 127 | write(*,*) "-day (2 digits)" |
|---|
| 128 | write(*,*) "-hour (2 digits)" |
|---|
| 129 | increment=1 |
|---|
| 130 | do while (increment.ne.FILES+1) |
|---|
| 131 | read(*,*) str |
|---|
| 132 | read(*,*) str2 |
|---|
| 133 | read(*,*) str3 |
|---|
| 134 | read(*,*) str4 |
|---|
| 135 | date_out(increment)=str//'-'//str2//'-'//str3//'_'//str4 |
|---|
| 136 | date_out2(increment)=str//'-'//str2//'-'//str3//'_'//str4//':00:00' |
|---|
| 137 | print *,date_out(increment) |
|---|
| 138 | write(*,*) "ok? (y/n)" |
|---|
| 139 | read(*,*) answer |
|---|
| 140 | if (answer.eq.'n') then |
|---|
| 141 | write(*,*) "please write again" |
|---|
| 142 | else |
|---|
| 143 | write(*,*) "next one, please" |
|---|
| 144 | increment=increment+1 |
|---|
| 145 | endif |
|---|
| 146 | enddo |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | !!------------------- |
|---|
| 150 | !! Get array sizes |
|---|
| 151 | !!------------------- |
|---|
| 152 | ierr=NF_INQ_DIMID(nid,"Time",timedim) |
|---|
| 153 | ierr=NF_INQ_DIMLEN(nid,timedim,timelen) |
|---|
| 154 | write(*,*) "timelen: ",timelen |
|---|
| 155 | ierr=NF_INQ_DIMID(nid,"latitude",latdim) |
|---|
| 156 | ierr=NF_INQ_DIMLEN(nid,latdim,latlen) |
|---|
| 157 | write(*,*) "latlen: ",latlen |
|---|
| 158 | ierr=NF_INQ_DIMID(nid,"longitude",londim) |
|---|
| 159 | ierr=NF_INQ_DIMLEN(nid,londim,lonlen) |
|---|
| 160 | write(*,*) "lonlen: ",lonlen |
|---|
| 161 | ierr=NF_INQ_DIMID(nid,"altitude",altdim) |
|---|
| 162 | ierr=NF_INQ_DIMLEN(nid,altdim,altlen) |
|---|
| 163 | write(*,*) "altlen: ",altlen |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | !!------------------------- |
|---|
| 168 | !! Allocate local arrays |
|---|
| 169 | !!------------------------- |
|---|
| 170 | allocate(eta_gcm(lonlen,latlen,altlen,timelen)) |
|---|
| 171 | allocate(tfile(lonlen,latlen,altlen,timelen)) |
|---|
| 172 | allocate(tfileorig(lonlen,latlen,altlen,timelen)) |
|---|
| 173 | allocate(ufile(lonlen,latlen,altlen,timelen)) |
|---|
| 174 | allocate(ufileorig(lonlen,latlen,altlen,timelen)) |
|---|
| 175 | allocate(vfile(lonlen,latlen,altlen,timelen)) |
|---|
| 176 | allocate(vfileorig(lonlen,latlen,altlen,timelen)) |
|---|
| 177 | allocate(rfile(lonlen,latlen,altlen,timelen)) |
|---|
| 178 | allocate(hfile(lonlen,latlen,altlen,timelen)) |
|---|
| 179 | allocate(psfile(lonlen,latlen,timelen)) |
|---|
| 180 | allocate(tsfile(lonlen,latlen,timelen)) |
|---|
| 181 | allocate(tnsfile(lonlen,latlen,timelen)) |
|---|
| 182 | allocate(unsfile(lonlen,latlen,timelen)) |
|---|
| 183 | allocate(vnsfile(lonlen,latlen,timelen)) |
|---|
| 184 | allocate(emissfile(lonlen,latlen,timelen)) |
|---|
| 185 | allocate(co2icefile(lonlen,latlen,timelen)) |
|---|
| 186 | allocate(ghtsfile(lonlen,latlen)) !! no scan axis |
|---|
| 187 | allocate(vide(lonlen,latlen)) |
|---|
| 188 | allocate(ones(lonlen,latlen)) |
|---|
| 189 | allocate(lat(latlen), lon(lonlen), alt(altlen), time(timelen)) |
|---|
| 190 | allocate(aps(altlen),bps(altlen),levels(altlen)) |
|---|
| 191 | |
|---|
| 192 | tfile(:,:,:,:)=0 |
|---|
| 193 | tfileorig(:,:,:,:)=0 |
|---|
| 194 | ufileorig(:,:,:,:)=0 |
|---|
| 195 | vfileorig(:,:,:,:)=0 |
|---|
| 196 | ufile(:,:,:,:)=0 |
|---|
| 197 | vfile(:,:,:,:)=0 |
|---|
| 198 | rfile(:,:,:,:)=0 |
|---|
| 199 | hfile(:,:,:,:)=0 |
|---|
| 200 | psfile(:,:,:)=0 |
|---|
| 201 | tsfile(:,:,:)=0 |
|---|
| 202 | emissfile(:,:,:)=0 |
|---|
| 203 | co2icefile(:,:,:)=0 |
|---|
| 204 | tnsfile(:,:,:)=0 |
|---|
| 205 | unsfile(:,:,:)=0 |
|---|
| 206 | vnsfile(:,:,:)=0 |
|---|
| 207 | ghtsfile(:,:)=0 |
|---|
| 208 | vide(:,:)=0 |
|---|
| 209 | ones(:,:)=0 |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | !!------------------- |
|---|
| 213 | !! Read dimensions |
|---|
| 214 | !!------------------- |
|---|
| 215 | |
|---|
| 216 | print *,'>>> Read dimensions !' |
|---|
| 217 | |
|---|
| 218 | print *,'Time' |
|---|
| 219 | ierr = NF_INQ_VARID (nid, "Time",nvarid) |
|---|
| 220 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 221 | PRINT *, "Error: Readmeteo <Time> not found" |
|---|
| 222 | stop |
|---|
| 223 | ENDIF |
|---|
| 224 | #ifdef NC_DOUBLE |
|---|
| 225 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time) |
|---|
| 226 | #else |
|---|
| 227 | ierr = NF_GET_VAR_REAL(nid, nvarid, time) |
|---|
| 228 | #endif |
|---|
| 229 | print *,time(1),' ... to ... ',time(timelen) |
|---|
| 230 | |
|---|
| 231 | print *,'Latitude' |
|---|
| 232 | ierr = NF_INQ_VARID (nid, "latitude",nvarid) |
|---|
| 233 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 234 | PRINT *, "Error: Readmeteo <latitude> not found" |
|---|
| 235 | stop |
|---|
| 236 | ENDIF |
|---|
| 237 | #ifdef NC_DOUBLE |
|---|
| 238 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, lat) |
|---|
| 239 | #else |
|---|
| 240 | ierr = NF_GET_VAR_REAL(nid, nvarid, lat) |
|---|
| 241 | #endif |
|---|
| 242 | print *,lat(1),' ... to ... ',lat(latlen),' ... step: ',lat(latlen)-lat(latlen-1) |
|---|
| 243 | |
|---|
| 244 | print *,'Longitude' |
|---|
| 245 | ierr = NF_INQ_VARID (nid, "longitude",nvarid) |
|---|
| 246 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 247 | PRINT *, "Error: Readmeteo <longitude> not found" |
|---|
| 248 | stop |
|---|
| 249 | ENDIF |
|---|
| 250 | #ifdef NC_DOUBLE |
|---|
| 251 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, lon) |
|---|
| 252 | #else |
|---|
| 253 | ierr = NF_GET_VAR_REAL(nid, nvarid, lon) |
|---|
| 254 | #endif |
|---|
| 255 | print *,lon(1),' ... to ... ',lon(lonlen),' ... step: ',lon(lonlen)-lon(lonlen-1) |
|---|
| 256 | |
|---|
| 257 | print *, 'Hybrid coordinates' |
|---|
| 258 | ierr = NF_INQ_VARID (nid, "aps", nvarid) |
|---|
| 259 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 260 | PRINT *, "Error: Readmeteo <aps> not found" |
|---|
| 261 | stop |
|---|
| 262 | ENDIF |
|---|
| 263 | #ifdef NC_DOUBLE |
|---|
| 264 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, aps) |
|---|
| 265 | #else |
|---|
| 266 | ierr = NF_GET_VAR_REAL(nid, nvarid, aps) |
|---|
| 267 | #endif |
|---|
| 268 | ierr = NF_INQ_VARID (nid, "bps", nvarid) |
|---|
| 269 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 270 | PRINT *, "Error: Readmeteo <bps> not found" |
|---|
| 271 | stop |
|---|
| 272 | ENDIF |
|---|
| 273 | #ifdef NC_DOUBLE |
|---|
| 274 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, bps) |
|---|
| 275 | #else |
|---|
| 276 | ierr = NF_GET_VAR_REAL(nid, nvarid, bps) |
|---|
| 277 | #endif |
|---|
| 278 | print *,aps(1),' ... to ... ',aps(altlen) |
|---|
| 279 | print *,bps(1),' ... to ... ',bps(altlen) |
|---|
| 280 | |
|---|
| 281 | |
|---|
| 282 | |
|---|
| 283 | |
|---|
| 284 | !!------------------------------------------- |
|---|
| 285 | !! Reading 2D and 3D meteorological fields |
|---|
| 286 | !!------------------------------------------- |
|---|
| 287 | |
|---|
| 288 | IF (blank .EQV. .false.) THEN |
|---|
| 289 | |
|---|
| 290 | print *,'>>> Read 2D optional fields !' |
|---|
| 291 | |
|---|
| 292 | print *,'Emissivity' |
|---|
| 293 | ierr = NF_INQ_VARID (nid,"emiss",nvarid) |
|---|
| 294 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 295 | PRINT *, '...warning: not found in diagfi !' |
|---|
| 296 | PRINT *, '...will be filled with a prescribed value', emiss_prescribed |
|---|
| 297 | emissfile(:,:,:)=emiss_prescribed |
|---|
| 298 | ELSE |
|---|
| 299 | #ifdef NC_DOUBLE |
|---|
| 300 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, emissfile) |
|---|
| 301 | #else |
|---|
| 302 | ierr = NF_GET_VAR_REAL(nid, nvarid, emissfile) |
|---|
| 303 | #endif |
|---|
| 304 | ENDIF |
|---|
| 305 | |
|---|
| 306 | print *,'CO2 ice' |
|---|
| 307 | ierr = NF_INQ_VARID (nid,"co2ice",nvarid) |
|---|
| 308 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 309 | PRINT *, '...warning: not found in diagfi !' |
|---|
| 310 | PRINT *, '...will be filled with a prescribed value', co2ice_prescribed |
|---|
| 311 | co2icefile(:,:,:)=co2ice_prescribed |
|---|
| 312 | ELSE |
|---|
| 313 | #ifdef NC_DOUBLE |
|---|
| 314 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, co2icefile) |
|---|
| 315 | #else |
|---|
| 316 | ierr = NF_GET_VAR_REAL(nid, nvarid, co2icefile) |
|---|
| 317 | #endif |
|---|
| 318 | ENDIF |
|---|
| 319 | |
|---|
| 320 | print *,'>>> Read 2D surface fields !' |
|---|
| 321 | |
|---|
| 322 | print *,'Surface Pressure' |
|---|
| 323 | ierr = NF_INQ_VARID (nid,"ps",nvarid) |
|---|
| 324 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 325 | PRINT *, "Error: Readmeteo <ps> not found" |
|---|
| 326 | stop |
|---|
| 327 | ENDIF |
|---|
| 328 | #ifdef NC_DOUBLE |
|---|
| 329 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, psfile) |
|---|
| 330 | #else |
|---|
| 331 | ierr = NF_GET_VAR_REAL(nid, nvarid, psfile) |
|---|
| 332 | #endif |
|---|
| 333 | |
|---|
| 334 | print *,'Ground Temperature' |
|---|
| 335 | ierr = NF_INQ_VARID (nid,"tsurf",nvarid) |
|---|
| 336 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 337 | PRINT *, "Error: Readmeteo <tsurf> not found" |
|---|
| 338 | stop |
|---|
| 339 | ENDIF |
|---|
| 340 | #ifdef NC_DOUBLE |
|---|
| 341 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tsfile) |
|---|
| 342 | #else |
|---|
| 343 | ierr = NF_GET_VAR_REAL(nid, nvarid, tsfile) |
|---|
| 344 | #endif |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | !!"atmospheric" surface temperature is taken |
|---|
| 348 | !!from original diagfi.nc first level |
|---|
| 349 | !!... level is ~3-5 meters |
|---|
| 350 | print *,'Near-Surface Temperature' |
|---|
| 351 | ierr = NF_INQ_VARID (nid,"temp",nvarid) |
|---|
| 352 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 353 | PRINT *, "Error: Readmeteo <temp> not found" |
|---|
| 354 | stop |
|---|
| 355 | ENDIF |
|---|
| 356 | #ifdef NC_DOUBLE |
|---|
| 357 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tfileorig) |
|---|
| 358 | #else |
|---|
| 359 | ierr = NF_GET_VAR_REAL(nid, nvarid, tfileorig) |
|---|
| 360 | #endif |
|---|
| 361 | tnsfile=tfileorig(:,:,1,:) |
|---|
| 362 | |
|---|
| 363 | !!"atmospheric" surface u is taken |
|---|
| 364 | !!from original diagfi.nc first level |
|---|
| 365 | !!... level is ~3-5 meters |
|---|
| 366 | print *,'Near-Surface Zonal Wind' |
|---|
| 367 | ierr = NF_INQ_VARID (nid,"u",nvarid) |
|---|
| 368 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 369 | PRINT *, "Error: Readmeteo <u> not found" |
|---|
| 370 | stop |
|---|
| 371 | ENDIF |
|---|
| 372 | #ifdef NC_DOUBLE |
|---|
| 373 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ufileorig) |
|---|
| 374 | #else |
|---|
| 375 | ierr = NF_GET_VAR_REAL(nid, nvarid, ufileorig) |
|---|
| 376 | #endif |
|---|
| 377 | unsfile=ufileorig(:,:,1,:) |
|---|
| 378 | |
|---|
| 379 | !!"atmospheric" surface v is taken |
|---|
| 380 | !!from original diagfi.nc first level |
|---|
| 381 | !!... level is ~3-5 meters |
|---|
| 382 | print *,'Near-Surface Meridional Wind' |
|---|
| 383 | ierr = NF_INQ_VARID (nid,"v",nvarid) |
|---|
| 384 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 385 | PRINT *, "Error: Readmeteo <v> not found" |
|---|
| 386 | stop |
|---|
| 387 | ENDIF |
|---|
| 388 | #ifdef NC_DOUBLE |
|---|
| 389 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vfileorig) |
|---|
| 390 | #else |
|---|
| 391 | ierr = NF_GET_VAR_REAL(nid, nvarid, vfileorig) |
|---|
| 392 | #endif |
|---|
| 393 | vnsfile=vfileorig(:,:,1,:) |
|---|
| 394 | |
|---|
| 395 | |
|---|
| 396 | print *,'Geopotential height at the ground' |
|---|
| 397 | ierr = NF_INQ_VARID (nid,"phisinit",nvarid) |
|---|
| 398 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 399 | PRINT *, "Error: Readmeteo <phisinit> not found" |
|---|
| 400 | stop |
|---|
| 401 | ENDIF |
|---|
| 402 | #ifdef NC_DOUBLE |
|---|
| 403 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ghtsfile) |
|---|
| 404 | #else |
|---|
| 405 | ierr = NF_GET_VAR_REAL(nid, nvarid, ghtsfile) |
|---|
| 406 | #endif |
|---|
| 407 | !**** from geopotential to geopotential height |
|---|
| 408 | ghtsfile=ghtsfile/grav |
|---|
| 409 | !**** |
|---|
| 410 | |
|---|
| 411 | print *,'>>> Read 3D meteorological fields ! - This may take some time ...' |
|---|
| 412 | |
|---|
| 413 | print *,'Temperature' |
|---|
| 414 | ierr = NF_INQ_VARID (nid,"temp",nvarid) |
|---|
| 415 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 416 | PRINT *, "Error: Readmeteo <t> not found" |
|---|
| 417 | stop |
|---|
| 418 | ENDIF |
|---|
| 419 | #ifdef NC_DOUBLE |
|---|
| 420 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tfile) |
|---|
| 421 | #else |
|---|
| 422 | ierr = NF_GET_VAR_REAL(nid, nvarid, tfile) |
|---|
| 423 | #endif |
|---|
| 424 | |
|---|
| 425 | print *,'Zonal wind' |
|---|
| 426 | ierr = NF_INQ_VARID (nid,"u",nvarid) |
|---|
| 427 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 428 | PRINT *, "Error: Readmeteo <u> not found" |
|---|
| 429 | stop |
|---|
| 430 | ENDIF |
|---|
| 431 | #ifdef NC_DOUBLE |
|---|
| 432 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ufile) |
|---|
| 433 | #else |
|---|
| 434 | ierr = NF_GET_VAR_REAL(nid, nvarid, ufile) |
|---|
| 435 | #endif |
|---|
| 436 | |
|---|
| 437 | print *,'Meridional wind' |
|---|
| 438 | ierr = NF_INQ_VARID (nid,"v",nvarid) |
|---|
| 439 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 440 | PRINT *, "Error: Readmeteo <v> not found" |
|---|
| 441 | stop |
|---|
| 442 | ENDIF |
|---|
| 443 | #ifdef NC_DOUBLE |
|---|
| 444 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vfile) |
|---|
| 445 | #else |
|---|
| 446 | ierr = NF_GET_VAR_REAL(nid, nvarid, vfile) |
|---|
| 447 | #endif |
|---|
| 448 | |
|---|
| 449 | ENDIF |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | !!----------------------------- |
|---|
| 453 | !! Loop on the written files |
|---|
| 454 | !! >>> what follows is pretty repetitive ... |
|---|
| 455 | !! gotta do something (one more loop?) |
|---|
| 456 | !!----------------------------- |
|---|
| 457 | |
|---|
| 458 | !!! Equivalent eta levels for WRF interpolation in initialize_real |
|---|
| 459 | !print *,'Computing equivalent eta levels' |
|---|
| 460 | ! |
|---|
| 461 | ! !ptop will be passed through RH(surface) |
|---|
| 462 | ! ptop=MINVAL(aps(altlen)+bps(altlen)*psfile(:,:,:)) |
|---|
| 463 | ! print *, 'ptop', ptop |
|---|
| 464 | ! |
|---|
| 465 | !print *, 'sample: equivalent eta levels at i=1,j=1' |
|---|
| 466 | !DO k = 1,altlen |
|---|
| 467 | ! levels(k)=-k |
|---|
| 468 | ! eta_gcm(:,:,k,:)=(aps(k)+bps(k)*psfile(:,:,:)-ptop)/(psfile(:,:,:)-ptop) |
|---|
| 469 | ! print *, eta_gcm(1,1,k,1) |
|---|
| 470 | !END DO |
|---|
| 471 | |
|---|
| 472 | !!---better to pass pressure values |
|---|
| 473 | !!---the eta treatment is done in module_initialize_real |
|---|
| 474 | DO k = 1,altlen |
|---|
| 475 | levels(k)=-k |
|---|
| 476 | !!dummy decreasing levels |
|---|
| 477 | END DO |
|---|
| 478 | |
|---|
| 479 | |
|---|
| 480 | |
|---|
| 481 | |
|---|
| 482 | !! Dummy surface level is XLVL=200100. |
|---|
| 483 | |
|---|
| 484 | |
|---|
| 485 | DO l=1,FILES |
|---|
| 486 | |
|---|
| 487 | |
|---|
| 488 | !!--------------------------------------------- |
|---|
| 489 | !! Write file in intermediate format for WPS |
|---|
| 490 | !! 1. Surface data |
|---|
| 491 | !!--------------------------------------------- |
|---|
| 492 | |
|---|
| 493 | ! |
|---|
| 494 | ! These variables remain the same in the "loop" |
|---|
| 495 | ! |
|---|
| 496 | HDATE=date_out(l) |
|---|
| 497 | IFV=4 |
|---|
| 498 | XFCST=0. |
|---|
| 499 | SOURCE='LMD GCM' |
|---|
| 500 | NX=lonlen |
|---|
| 501 | NY=latlen |
|---|
| 502 | ALLOCATE(SLAB(NX,NY)) |
|---|
| 503 | IPROJ=0 |
|---|
| 504 | STARTLOC='SWCORNER' |
|---|
| 505 | STARTLAT=lat(1) |
|---|
| 506 | STARTLON=lon(1) |
|---|
| 507 | DELTALAT=lat(latlen)-lat(latlen-1) |
|---|
| 508 | DELTALON=lon(lonlen)-lon(lonlen-1) |
|---|
| 509 | ! |
|---|
| 510 | ! Open the data destination file |
|---|
| 511 | ! |
|---|
| 512 | output=ident//"/"//ident//":"//date_out2(l) |
|---|
| 513 | open(UNIT=1, & |
|---|
| 514 | FILE=output, & |
|---|
| 515 | STATUS='REPLACE', & |
|---|
| 516 | FORM='UNFORMATTED', & |
|---|
| 517 | ACCESS='SEQUENTIAL') |
|---|
| 518 | |
|---|
| 519 | !------------------------! |
|---|
| 520 | ! >>> Write a variable ! |
|---|
| 521 | ! ... Copy&Paste part ! |
|---|
| 522 | !------------------------! |
|---|
| 523 | FIELD='T' |
|---|
| 524 | UNITS='K' |
|---|
| 525 | DESC='Atmospheric temperature' |
|---|
| 526 | XLVL=200100. |
|---|
| 527 | !SLAB=tsfile(:,:,time_out(l)) |
|---|
| 528 | !SLAB=tfileorig(:,:,1,time_out(l)) |
|---|
| 529 | SLAB=tnsfile(:,:,time_out(l)) |
|---|
| 530 | ! And now put everything in the destination file |
|---|
| 531 | ! ... Header |
|---|
| 532 | write(1) IFV |
|---|
| 533 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 534 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 535 | ! ... Data |
|---|
| 536 | write(1) SLAB |
|---|
| 537 | print *,'The field '//DESC//' was written to '//output |
|---|
| 538 | |
|---|
| 539 | !------------------------! |
|---|
| 540 | ! >>> Write a variable ! |
|---|
| 541 | ! ... Copy&Paste part ! |
|---|
| 542 | !------------------------! |
|---|
| 543 | FIELD='U' |
|---|
| 544 | UNITS='m s{-1}' |
|---|
| 545 | DESC='Zonal wind' |
|---|
| 546 | XLVL=200100. |
|---|
| 547 | !SLAB=ufile(:,:,1,time_out(l)) |
|---|
| 548 | !SLAB=ufileorig(:,:,1,time_out(l)) |
|---|
| 549 | SLAB=unsfile(:,:,time_out(l)) |
|---|
| 550 | ! And now put everything in the destination file |
|---|
| 551 | ! ... Header |
|---|
| 552 | write(1) IFV |
|---|
| 553 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 554 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 555 | ! ... Data |
|---|
| 556 | write(1) SLAB |
|---|
| 557 | print *,'The field '//DESC//' was written to '//output |
|---|
| 558 | |
|---|
| 559 | !------------------------! |
|---|
| 560 | ! >>> Write a variable ! |
|---|
| 561 | ! ... Copy&Paste part ! |
|---|
| 562 | !------------------------! |
|---|
| 563 | FIELD='V' |
|---|
| 564 | UNITS='m s{-1}' |
|---|
| 565 | DESC='Meridional wind' |
|---|
| 566 | XLVL=200100. |
|---|
| 567 | !SLAB=vfile(:,:,1,time_out(l)) |
|---|
| 568 | !SLAB=vfileorig(:,:,1,time_out(l)) |
|---|
| 569 | SLAB=vnsfile(:,:,time_out(l)) |
|---|
| 570 | ! And now put everything in the destination file |
|---|
| 571 | ! ... Header |
|---|
| 572 | write(1) IFV |
|---|
| 573 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 574 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 575 | ! ... Data |
|---|
| 576 | write(1) SLAB |
|---|
| 577 | print *,'The field '//DESC//' was written to '//output |
|---|
| 578 | |
|---|
| 579 | !------------------------! |
|---|
| 580 | ! >>> Write a variable ! |
|---|
| 581 | ! ... Copy&Paste part ! |
|---|
| 582 | !------------------------! |
|---|
| 583 | FIELD='RH' |
|---|
| 584 | UNITS='' |
|---|
| 585 | DESC='Customized 2D static field' |
|---|
| 586 | XLVL=200100. |
|---|
| 587 | !SLAB=co2icefile(:,:,time_out(l)) |
|---|
| 588 | SLAB=vide(:,:) |
|---|
| 589 | !SLAB=vide(:,:)+ptop |
|---|
| 590 | ! And now put everything in the destination file |
|---|
| 591 | ! ... Header |
|---|
| 592 | write(1) IFV |
|---|
| 593 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 594 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 595 | ! ... Data |
|---|
| 596 | write(1) SLAB |
|---|
| 597 | print *,'The field '//DESC//' was written to '//output |
|---|
| 598 | |
|---|
| 599 | !------------------------! |
|---|
| 600 | ! >>> Write a variable ! |
|---|
| 601 | ! ... Copy&Paste part ! |
|---|
| 602 | !------------------------! |
|---|
| 603 | FIELD='SOILHGT' |
|---|
| 604 | UNITS='m' |
|---|
| 605 | DESC='Terrain field of source analysis' !Ground geopotential height |
|---|
| 606 | XLVL=200100. |
|---|
| 607 | SLAB=ghtsfile(:,:) |
|---|
| 608 | ! And now put everything in the destination file |
|---|
| 609 | ! ... Header |
|---|
| 610 | write(1) IFV |
|---|
| 611 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 612 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 613 | ! ... Data |
|---|
| 614 | write(1) SLAB |
|---|
| 615 | print *,'The field '//DESC//' was written to '//output |
|---|
| 616 | |
|---|
| 617 | !------------------------! |
|---|
| 618 | ! >>> Write a variable ! |
|---|
| 619 | ! ... Copy&Paste part ! |
|---|
| 620 | !------------------------! |
|---|
| 621 | FIELD='PSFC' |
|---|
| 622 | UNITS='Pa' |
|---|
| 623 | DESC='Surface Pressure' |
|---|
| 624 | XLVL=200100. |
|---|
| 625 | SLAB=psfile(:,:,time_out(l)) |
|---|
| 626 | ! And now put everything in the destination file |
|---|
| 627 | ! ... Header |
|---|
| 628 | write(1) IFV |
|---|
| 629 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 630 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 631 | ! ... Data |
|---|
| 632 | write(1) SLAB |
|---|
| 633 | print *,'The field '//DESC//' was written to '//output |
|---|
| 634 | |
|---|
| 635 | !------------------------! |
|---|
| 636 | ! >>> Write a variable ! |
|---|
| 637 | ! ... Copy&Paste part ! |
|---|
| 638 | !------------------------! |
|---|
| 639 | FIELD='ST000010' |
|---|
| 640 | UNITS='' |
|---|
| 641 | DESC='Emissivity' |
|---|
| 642 | XLVL=200100. |
|---|
| 643 | !SLAB=vide(:,:) |
|---|
| 644 | SLAB=emissfile(:,:,time_out(l)) |
|---|
| 645 | ! And now put everything in the destination file |
|---|
| 646 | ! ... Header |
|---|
| 647 | write(1) IFV |
|---|
| 648 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 649 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 650 | ! ... Data |
|---|
| 651 | write(1) SLAB |
|---|
| 652 | print *,'The field '//DESC//' was written to '//output |
|---|
| 653 | |
|---|
| 654 | !------------------------! |
|---|
| 655 | ! >>> Write a variable ! |
|---|
| 656 | ! ... Copy&Paste part ! |
|---|
| 657 | !------------------------! |
|---|
| 658 | FIELD='ST010040' |
|---|
| 659 | UNITS='' |
|---|
| 660 | DESC='CO2 ice' |
|---|
| 661 | XLVL=200100. |
|---|
| 662 | !SLAB=vide(:,:) |
|---|
| 663 | SLAB=co2icefile(:,:,time_out(l)) |
|---|
| 664 | ! And now put everything in the destination file |
|---|
| 665 | ! ... Header |
|---|
| 666 | write(1) IFV |
|---|
| 667 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 668 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 669 | ! ... Data |
|---|
| 670 | write(1) SLAB |
|---|
| 671 | print *,'The field '//DESC//' was written to '//output |
|---|
| 672 | |
|---|
| 673 | !------------------------! |
|---|
| 674 | ! >>> Write a variable ! |
|---|
| 675 | ! ... Copy&Paste part ! |
|---|
| 676 | !------------------------! |
|---|
| 677 | FIELD='ST040100' |
|---|
| 678 | UNITS='K' |
|---|
| 679 | DESC='T of 40-100 cm ground layer' |
|---|
| 680 | XLVL=200100. |
|---|
| 681 | SLAB=vide(:,:) |
|---|
| 682 | ! And now put everything in the destination file |
|---|
| 683 | ! ... Header |
|---|
| 684 | write(1) IFV |
|---|
| 685 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 686 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 687 | ! ... Data |
|---|
| 688 | write(1) SLAB |
|---|
| 689 | print *,'The field '//DESC//' was written to '//output |
|---|
| 690 | |
|---|
| 691 | !------------------------! |
|---|
| 692 | ! >>> Write a variable ! |
|---|
| 693 | ! ... Copy&Paste part ! |
|---|
| 694 | !------------------------! |
|---|
| 695 | FIELD='ST100200' |
|---|
| 696 | UNITS='K' |
|---|
| 697 | DESC='T of 100-200 cm ground layer' |
|---|
| 698 | XLVL=200100. |
|---|
| 699 | SLAB=vide(:,:) |
|---|
| 700 | ! And now put everything in the destination file |
|---|
| 701 | ! ... Header |
|---|
| 702 | write(1) IFV |
|---|
| 703 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 704 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 705 | ! ... Data |
|---|
| 706 | write(1) SLAB |
|---|
| 707 | print *,'The field '//DESC//' was written to '//output |
|---|
| 708 | |
|---|
| 709 | !------------------------! |
|---|
| 710 | ! >>> Write a variable ! |
|---|
| 711 | ! ... Copy&Paste part ! |
|---|
| 712 | !------------------------! |
|---|
| 713 | FIELD='LANDSEA' |
|---|
| 714 | UNITS='0/1 Flag' |
|---|
| 715 | DESC='Land/Sea flag' |
|---|
| 716 | XLVL=200100. |
|---|
| 717 | SLAB=ones(:,:) |
|---|
| 718 | ! And now put everything in the destination file |
|---|
| 719 | ! ... Header |
|---|
| 720 | write(1) IFV |
|---|
| 721 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 722 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 723 | ! ... Data |
|---|
| 724 | write(1) SLAB |
|---|
| 725 | print *,'The field '//DESC//' was written to '//output |
|---|
| 726 | |
|---|
| 727 | !------------------------! |
|---|
| 728 | ! >>> Write a variable ! |
|---|
| 729 | ! ... Copy&Paste part ! |
|---|
| 730 | !------------------------! |
|---|
| 731 | FIELD='SKINTEMP' |
|---|
| 732 | UNITS='K' |
|---|
| 733 | DESC='Ground temperature' |
|---|
| 734 | XLVL=200100. |
|---|
| 735 | !SLAB=vide(:,:) |
|---|
| 736 | SLAB=tsfile(:,:,time_out(l)) |
|---|
| 737 | ! And now put everything in the destination file |
|---|
| 738 | ! ... Header |
|---|
| 739 | write(1) IFV |
|---|
| 740 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 741 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 742 | ! ... Data |
|---|
| 743 | write(1) SLAB |
|---|
| 744 | print *,'The field '//DESC//' was written to '//output |
|---|
| 745 | |
|---|
| 746 | !------------------------! |
|---|
| 747 | ! >>> Write a variable ! |
|---|
| 748 | ! ... Copy&Paste part ! |
|---|
| 749 | !------------------------! |
|---|
| 750 | FIELD='SM000010' |
|---|
| 751 | UNITS='fraction' |
|---|
| 752 | DESC='Relative humidity' |
|---|
| 753 | XLVL=200100. |
|---|
| 754 | SLAB=vide(:,:) |
|---|
| 755 | ! And now put everything in the destination file |
|---|
| 756 | ! ... Header |
|---|
| 757 | write(1) IFV |
|---|
| 758 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 759 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 760 | ! ... Data |
|---|
| 761 | write(1) SLAB |
|---|
| 762 | print *,'The field '//DESC//' was written to '//output |
|---|
| 763 | |
|---|
| 764 | !------------------------! |
|---|
| 765 | ! >>> Write a variable ! |
|---|
| 766 | ! ... Copy&Paste part ! |
|---|
| 767 | !------------------------! |
|---|
| 768 | FIELD='SM010040' |
|---|
| 769 | UNITS='fraction' |
|---|
| 770 | DESC='Relative humidity' |
|---|
| 771 | XLVL=200100. |
|---|
| 772 | SLAB=vide(:,:) |
|---|
| 773 | ! And now put everything in the destination file |
|---|
| 774 | ! ... Header |
|---|
| 775 | write(1) IFV |
|---|
| 776 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 777 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 778 | ! ... Data |
|---|
| 779 | write(1) SLAB |
|---|
| 780 | print *,'The field '//DESC//' was written to '//output |
|---|
| 781 | |
|---|
| 782 | !------------------------! |
|---|
| 783 | ! >>> Write a variable ! |
|---|
| 784 | ! ... Copy&Paste part ! |
|---|
| 785 | !------------------------! |
|---|
| 786 | FIELD='SM040100' |
|---|
| 787 | UNITS='fraction' |
|---|
| 788 | DESC='Relative humidity' |
|---|
| 789 | XLVL=200100. |
|---|
| 790 | SLAB=vide(:,:) |
|---|
| 791 | ! And now put everything in the destination file |
|---|
| 792 | ! ... Header |
|---|
| 793 | write(1) IFV |
|---|
| 794 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 795 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 796 | ! ... Data |
|---|
| 797 | write(1) SLAB |
|---|
| 798 | print *,'The field '//DESC//' was written to '//output |
|---|
| 799 | |
|---|
| 800 | !------------------------! |
|---|
| 801 | ! >>> Write a variable ! |
|---|
| 802 | ! ... Copy&Paste part ! |
|---|
| 803 | !------------------------! |
|---|
| 804 | FIELD='SM100200' |
|---|
| 805 | UNITS='fraction' |
|---|
| 806 | DESC='Relative humidity' |
|---|
| 807 | XLVL=200100. |
|---|
| 808 | SLAB=vide(:,:) |
|---|
| 809 | ! And now put everything in the destination file |
|---|
| 810 | ! ... Header |
|---|
| 811 | write(1) IFV |
|---|
| 812 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 813 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 814 | ! ... Data |
|---|
| 815 | write(1) SLAB |
|---|
| 816 | print *,'The field '//DESC//' was written to '//output |
|---|
| 817 | |
|---|
| 818 | |
|---|
| 819 | |
|---|
| 820 | !!---------------------------------------------------- |
|---|
| 821 | !! Write file in intermediate format for WPS |
|---|
| 822 | !! 2. 3D meteorological data |
|---|
| 823 | !! >>> same stuff, but handle vertical profile |
|---|
| 824 | !! >>> !! XLVL must be decreasing (pressure levels) |
|---|
| 825 | !!---------------------------------------------------- |
|---|
| 826 | |
|---|
| 827 | !------------------------! |
|---|
| 828 | ! >>> Write a variable ! |
|---|
| 829 | ! ... Copy&Paste part ! |
|---|
| 830 | !------------------------! |
|---|
| 831 | FIELD='T' |
|---|
| 832 | UNITS='K' |
|---|
| 833 | DESC='Atmospheric temperature' |
|---|
| 834 | DO k = 1,altlen |
|---|
| 835 | XLVL=levels(k) |
|---|
| 836 | SLAB=tfile(:,:,k,time_out(l)) |
|---|
| 837 | ! And now put everything in the destination file |
|---|
| 838 | ! ... Header |
|---|
| 839 | write(1) IFV |
|---|
| 840 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 841 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 842 | ! ... Data |
|---|
| 843 | write(1) SLAB |
|---|
| 844 | END DO |
|---|
| 845 | print *,'The field '//DESC//' was written to '//output |
|---|
| 846 | |
|---|
| 847 | !------------------------! |
|---|
| 848 | ! >>> Write a variable ! |
|---|
| 849 | ! ... Copy&Paste part ! |
|---|
| 850 | !------------------------! |
|---|
| 851 | FIELD='U' |
|---|
| 852 | UNITS='m s{-1}' |
|---|
| 853 | DESC='Zonal wind' |
|---|
| 854 | DO k = 1,altlen |
|---|
| 855 | XLVL=levels(k) |
|---|
| 856 | SLAB=ufile(:,:,k,time_out(l)) |
|---|
| 857 | ! And now put everything in the destination file |
|---|
| 858 | ! ... Header |
|---|
| 859 | write(1) IFV |
|---|
| 860 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 861 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 862 | ! ... Data |
|---|
| 863 | write(1) SLAB |
|---|
| 864 | END DO |
|---|
| 865 | print *,'The field '//DESC//' was written to '//output |
|---|
| 866 | |
|---|
| 867 | !------------------------! |
|---|
| 868 | ! >>> Write a variable ! |
|---|
| 869 | ! ... Copy&Paste part ! |
|---|
| 870 | !------------------------! |
|---|
| 871 | FIELD='V' |
|---|
| 872 | UNITS='m s{-1}' |
|---|
| 873 | DESC='Meridional wind' |
|---|
| 874 | DO k = 1,altlen |
|---|
| 875 | XLVL=levels(k) |
|---|
| 876 | SLAB=vfile(:,:,k,time_out(l)) |
|---|
| 877 | ! And now put everything in the destination file |
|---|
| 878 | ! ... Header |
|---|
| 879 | write(1) IFV |
|---|
| 880 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 881 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 882 | ! ... Data |
|---|
| 883 | write(1) SLAB |
|---|
| 884 | END DO |
|---|
| 885 | print *,'The field '//DESC//' was written to '//output |
|---|
| 886 | |
|---|
| 887 | !------------------------! |
|---|
| 888 | ! >>> Write a variable ! |
|---|
| 889 | ! ... Copy&Paste part ! |
|---|
| 890 | !------------------------! |
|---|
| 891 | FIELD='RH' |
|---|
| 892 | UNITS='' |
|---|
| 893 | DESC='Customized 2D static field' |
|---|
| 894 | DESC='Eta-levels from the GCM' |
|---|
| 895 | DESC='Pressure values from the GCM' |
|---|
| 896 | DO k = 1,altlen |
|---|
| 897 | XLVL=levels(k) |
|---|
| 898 | !SLAB=rfile(:,:,k,time_out(l)) |
|---|
| 899 | !SLAB=eta_gcm(:,:,k,time_out(l)) |
|---|
| 900 | SLAB=aps(k)+bps(k)*psfile(:,:,time_out(l)) |
|---|
| 901 | ! And now put everything in the destination file |
|---|
| 902 | ! ... Header |
|---|
| 903 | write(1) IFV |
|---|
| 904 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 905 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 906 | ! ... Data |
|---|
| 907 | write(1) SLAB |
|---|
| 908 | END DO |
|---|
| 909 | print *,'The field '//DESC//' was written to '//output |
|---|
| 910 | |
|---|
| 911 | !------------------------! |
|---|
| 912 | ! >>> Write a variable ! |
|---|
| 913 | ! ... Copy&Paste part ! |
|---|
| 914 | !------------------------! |
|---|
| 915 | FIELD='HGT' |
|---|
| 916 | UNITS='m' |
|---|
| 917 | DESC='Height' |
|---|
| 918 | DO k = 1,altlen |
|---|
| 919 | XLVL=levels(k) |
|---|
| 920 | !!******* |
|---|
| 921 | !! PROVISOIRE: normalement, il faudrait la hauteur geopotentielle |
|---|
| 922 | !!******* |
|---|
| 923 | !!SLAB=hfile(:,:,k,time_out(l)) |
|---|
| 924 | !!SLAB=vide(:,:) |
|---|
| 925 | SLAB=10000.*alog(610./(aps(k)+bps(k)*psfile(:,:,time_out(l)))) |
|---|
| 926 | !!however, not used by initialize_real |
|---|
| 927 | ! And now put everything in the destination file |
|---|
| 928 | ! ... Header |
|---|
| 929 | write(1) IFV |
|---|
| 930 | write(1) HDATE,XFCST,SOURCE,FIELD,UNITS,DESC,XLVL,NX,NY,IPROJ |
|---|
| 931 | write(1) STARTLOC,STARTLAT,STARTLON,DELTALAT,DELTALON |
|---|
| 932 | ! ... Data |
|---|
| 933 | write(1) SLAB |
|---|
| 934 | END DO |
|---|
| 935 | print *,'The field '//DESC//' was written to '//output |
|---|
| 936 | |
|---|
| 937 | print *,'****Close file '//output |
|---|
| 938 | close(1) |
|---|
| 939 | |
|---|
| 940 | DEALLOCATE(SLAB) |
|---|
| 941 | |
|---|
| 942 | END DO !! end of the files loop |
|---|
| 943 | |
|---|
| 944 | |
|---|
| 945 | !!------------------------- |
|---|
| 946 | !! DeAllocate local arrays |
|---|
| 947 | !!------------------------- |
|---|
| 948 | deallocate(eta_gcm) |
|---|
| 949 | deallocate(tfile) |
|---|
| 950 | deallocate(tfileorig) |
|---|
| 951 | deallocate(ufile) |
|---|
| 952 | deallocate(ufileorig) |
|---|
| 953 | deallocate(vfile) |
|---|
| 954 | deallocate(vfileorig) |
|---|
| 955 | deallocate(rfile) |
|---|
| 956 | deallocate(hfile) |
|---|
| 957 | deallocate(psfile) |
|---|
| 958 | deallocate(tsfile) |
|---|
| 959 | deallocate(tnsfile) |
|---|
| 960 | deallocate(unsfile) |
|---|
| 961 | deallocate(vnsfile) |
|---|
| 962 | deallocate(emissfile) |
|---|
| 963 | deallocate(co2icefile) |
|---|
| 964 | deallocate(ghtsfile) !! no scan axis |
|---|
| 965 | deallocate(vide) |
|---|
| 966 | deallocate(ones) |
|---|
| 967 | deallocate(lat, lon, alt, time) |
|---|
| 968 | deallocate(aps,bps,levels) |
|---|
| 969 | |
|---|
| 970 | |
|---|
| 971 | print *, 'End of pre-WPS process !' |
|---|
| 972 | |
|---|
| 973 | |
|---|
| 974 | end |
|---|