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