[2089] | 1 | SUBROUTINE iotd_ini(fichnom,iim,jjm,llm,prlonv,prlatu,pcoordv) |
---|
| 2 | IMPLICIT NONE |
---|
| 3 | |
---|
| 4 | !======================================================================= |
---|
| 5 | ! |
---|
| 6 | ! Auteur: L. Fairhead , P. Le Van, Y. Wanherdrick, F. Forget |
---|
| 7 | ! ------- |
---|
| 8 | ! |
---|
| 9 | ! Objet: |
---|
| 10 | ! ------ |
---|
| 11 | ! |
---|
| 12 | ! 'Initialize' the diagfi.nc file: write down dimensions as well |
---|
| 13 | ! as time-independent fields (e.g: geopotential, mesh area, ...) |
---|
| 14 | ! |
---|
| 15 | !======================================================================= |
---|
| 16 | !----------------------------------------------------------------------- |
---|
| 17 | ! Declarations: |
---|
| 18 | ! ------------- |
---|
| 19 | |
---|
| 20 | #include "netcdf.inc" |
---|
| 21 | #include "iotd.h" |
---|
| 22 | |
---|
| 23 | ! Arguments: |
---|
| 24 | ! ---------- |
---|
| 25 | |
---|
| 26 | integer iim,jjm,llm |
---|
| 27 | real prlonv(iim),prlatu(jjm),pcoordv(llm),timestep |
---|
| 28 | INTEGER id_FOCE |
---|
| 29 | |
---|
| 30 | integer corner(4),edges(4),ndim |
---|
| 31 | real px(1000) |
---|
| 32 | character (len=10) :: nom |
---|
| 33 | |
---|
| 34 | ! Local: |
---|
| 35 | ! ------ |
---|
| 36 | INTEGER ierr |
---|
| 37 | |
---|
| 38 | integer :: nvarid |
---|
| 39 | integer, dimension(2) :: id |
---|
| 40 | integer :: varid |
---|
| 41 | |
---|
| 42 | character*10 fichnom |
---|
| 43 | real*4 rlonv(iim),rlatu(jjm),coordv(llm) |
---|
| 44 | |
---|
| 45 | real pi |
---|
| 46 | |
---|
| 47 | print*,'INIIO prlonv ',prlonv |
---|
| 48 | imax=iim |
---|
| 49 | jmax=jjm |
---|
| 50 | lmax=llm |
---|
| 51 | |
---|
| 52 | rlonv=prlonv |
---|
| 53 | rlatu=prlatu |
---|
| 54 | coordv=pcoordv |
---|
| 55 | |
---|
| 56 | !----------------------------------------------------------------------- |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | pi=2.*asin(1.) |
---|
| 60 | |
---|
| 61 | ! Define dimensions |
---|
| 62 | |
---|
| 63 | ! Create the NetCDF file |
---|
| 64 | ierr=NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
| 65 | ! Define the 'Time' dimension |
---|
| 66 | ierr=nf_def_dim(nid,"Time",NF_UNLIMITED,dim_coord(4)) |
---|
| 67 | ! Define the 'Time' variable |
---|
| 68 | ierr=NF_DEF_VAR(nid, "Time", NF_FLOAT, 1, dim_coord(4),varid) |
---|
| 69 | ! ! Add a long_name attribute |
---|
| 70 | ! ierr=NF_PUT_ATT_TEXT(nid, varid, "long_name",4,"Time") |
---|
| 71 | ! ! Add a units attribute |
---|
| 72 | ierr=NF_PUT_ATT_TEXT(nid, varid,'units',29,"days since 0000-00-0 00:00:00") |
---|
| 73 | ! Switch out of NetCDF Define mode |
---|
| 74 | |
---|
| 75 | ierr=NF_DEF_DIM(nid, "longitude", iim, dim_coord(1)) |
---|
| 76 | ierr=NF_DEF_DIM(nid, "latitude", jjm, dim_coord(2)) |
---|
| 77 | ierr=NF_DEF_DIM(nid, "altitude", llm, dim_coord(3)) |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | ierr=NF_ENDDEF(nid) |
---|
| 81 | ! |
---|
| 82 | ! Contol parameters for this run |
---|
| 83 | ! -------------------------- |
---|
| 84 | |
---|
| 85 | ierr=NF_REDEF(nid) |
---|
| 86 | ierr=NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, dim_coord(1),nvarid) |
---|
| 87 | ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name", 14, |
---|
| 88 | ! . "East longitude") |
---|
| 89 | ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east") |
---|
| 90 | ierr=NF_ENDDEF(nid) |
---|
| 91 | ierr=NF_PUT_VAR_REAL(nid,nvarid,rlonv) |
---|
| 92 | print*,ierr |
---|
| 93 | |
---|
| 94 | ! -------------------------- |
---|
| 95 | ierr=NF_REDEF(nid) |
---|
| 96 | ierr=NF_DEF_VAR(nid, "latitude", NF_FLOAT, 1, dim_coord(2),nvarid) |
---|
| 97 | ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north") |
---|
| 98 | ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name", 14,"North latitude") |
---|
| 99 | ierr=NF_ENDDEF(nid) |
---|
| 100 | ierr=NF_PUT_VAR_REAL(nid,nvarid,rlatu) |
---|
| 101 | ! |
---|
| 102 | ! -------------------------- |
---|
| 103 | ierr=NF_REDEF(nid) |
---|
| 104 | ierr=NF_DEF_VAR(nid, "altitude", NF_FLOAT, 1,dim_coord(3),nvarid) |
---|
| 105 | ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"pseudo-alt") |
---|
| 106 | ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',2,"km") |
---|
| 107 | if ( pcoordv(2)>pcoordv(1) ) then |
---|
| 108 | ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"pseudo-alt") |
---|
| 109 | ierr=NF_PUT_ATT_TEXT(nid,nvarid,'positive',2,"up") |
---|
| 110 | else |
---|
| 111 | ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",8,"pressure") |
---|
| 112 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',4,"down") |
---|
| 113 | endif |
---|
| 114 | ierr=NF_ENDDEF(nid) |
---|
| 115 | |
---|
| 116 | ierr=NF_PUT_VAR_REAL(nid,nvarid,coordv) |
---|
| 117 | ! |
---|
| 118 | END |
---|