1 | SUBROUTINE iniwrite_specIR(nid,idayref) |
---|
2 | |
---|
3 | use radinc_h, only: L_NSPECTI |
---|
4 | use radcommon_h, only: WNOI,DWNI |
---|
5 | ! use comsoil_h |
---|
6 | |
---|
7 | implicit none |
---|
8 | |
---|
9 | c======================================================================= |
---|
10 | c |
---|
11 | c Auteur: L. Fairhead , P. Le Van, Y. Wanherdrick, F. Forget |
---|
12 | c ------- |
---|
13 | c |
---|
14 | c Objet: |
---|
15 | c ------ |
---|
16 | c |
---|
17 | c 'Initialize' the diagfi_spec.nc file: write down dimensions as well |
---|
18 | c as time-independent fields (e.g: geopotential, mesh area, ...) |
---|
19 | c |
---|
20 | c======================================================================= |
---|
21 | c----------------------------------------------------------------------- |
---|
22 | c Declarations: |
---|
23 | c ------------- |
---|
24 | |
---|
25 | #include "dimensions.h" |
---|
26 | #include "paramet.h" |
---|
27 | !include "comconst.h" |
---|
28 | #include "comcstfi.h" |
---|
29 | #include "comvert.h" |
---|
30 | #include "comgeom.h" |
---|
31 | #include "temps.h" |
---|
32 | #include "ener.h" |
---|
33 | #include "logic.h" |
---|
34 | #include "netcdf.inc" |
---|
35 | #include "description.h" |
---|
36 | #include "serre.h" |
---|
37 | #include"dimphys.h" |
---|
38 | |
---|
39 | c Arguments: |
---|
40 | c ---------- |
---|
41 | |
---|
42 | integer,intent(in) :: nid ! NetCDF file ID |
---|
43 | INTEGER*4,intent(in) :: idayref ! date (initial date for this run) |
---|
44 | |
---|
45 | c Local: |
---|
46 | c ------ |
---|
47 | INTEGER length,l |
---|
48 | parameter (length = 100) |
---|
49 | REAL tab_cntrl(length) ! run parameters are stored in this array |
---|
50 | INTEGER ierr |
---|
51 | |
---|
52 | integer :: nvarid,idim_index,idim_rlonu,idim_rlonv |
---|
53 | integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm |
---|
54 | ! integer :: idim_nsoilmx ! "subsurface_layers" dimension ID # |
---|
55 | integer :: idim_bandsIR ! "IR Wavenumber" dimension ID # |
---|
56 | integer, dimension(2) :: id |
---|
57 | |
---|
58 | c----------------------------------------------------------------------- |
---|
59 | |
---|
60 | DO l=1,length |
---|
61 | tab_cntrl(l)=0. |
---|
62 | ENDDO |
---|
63 | tab_cntrl(1) = FLOAT(iim) |
---|
64 | tab_cntrl(2) = FLOAT(jjm) |
---|
65 | tab_cntrl(3) = FLOAT(llm) |
---|
66 | tab_cntrl(4) = FLOAT(idayref) |
---|
67 | tab_cntrl(5) = rad |
---|
68 | tab_cntrl(6) = omeg |
---|
69 | tab_cntrl(7) = g |
---|
70 | tab_cntrl(8) = mugaz |
---|
71 | tab_cntrl(9) = rcp |
---|
72 | tab_cntrl(10) = daysec |
---|
73 | tab_cntrl(11) = dtphys |
---|
74 | tab_cntrl(12) = etot0 |
---|
75 | tab_cntrl(13) = ptot0 |
---|
76 | tab_cntrl(14) = ztot0 |
---|
77 | tab_cntrl(15) = stot0 |
---|
78 | tab_cntrl(16) = ang0 |
---|
79 | c |
---|
80 | c .......... P.Le Van ( ajout le 8/04/96 ) ......... |
---|
81 | c ..... parametres pour le zoom ...... |
---|
82 | tab_cntrl(17) = clon |
---|
83 | tab_cntrl(18) = clat |
---|
84 | tab_cntrl(19) = grossismx |
---|
85 | tab_cntrl(20) = grossismy |
---|
86 | c |
---|
87 | c ..... ajout le 6/05/97 et le 15/10/97 ....... |
---|
88 | c |
---|
89 | IF ( fxyhypb ) THEN |
---|
90 | tab_cntrl(21) = 1. |
---|
91 | tab_cntrl(22) = dzoomx |
---|
92 | tab_cntrl(23) = dzoomy |
---|
93 | ELSE |
---|
94 | tab_cntrl(21) = 0. |
---|
95 | tab_cntrl(22) = dzoomx |
---|
96 | tab_cntrl(23) = dzoomy |
---|
97 | tab_cntrl(24) = 0. |
---|
98 | IF( ysinus ) tab_cntrl(24) = 1. |
---|
99 | ENDIF |
---|
100 | |
---|
101 | c ......................................................... |
---|
102 | |
---|
103 | ! Define dimensions |
---|
104 | |
---|
105 | ierr = NF_REDEF (nid) |
---|
106 | |
---|
107 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
108 | ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu) |
---|
109 | ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv) |
---|
110 | ierr = NF_DEF_DIM (nid, "IR Wavenumber",L_NSPECTI,idim_bandsIR) |
---|
111 | |
---|
112 | ierr = NF_ENDDEF(nid) |
---|
113 | |
---|
114 | c Contol parameters for this run |
---|
115 | ierr = NF_REDEF (nid) |
---|
116 | #ifdef NC_DOUBLE |
---|
117 | ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, |
---|
118 | . idim_index,nvarid) |
---|
119 | #else |
---|
120 | ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, |
---|
121 | . idim_index,nvarid) |
---|
122 | #endif |
---|
123 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18, |
---|
124 | . "Control parameters") |
---|
125 | ierr = NF_ENDDEF(nid) |
---|
126 | #ifdef NC_DOUBLE |
---|
127 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
128 | #else |
---|
129 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
130 | #endif |
---|
131 | |
---|
132 | c -------------------------- |
---|
133 | c longitudes and latitudes |
---|
134 | |
---|
135 | |
---|
136 | ierr = NF_REDEF (nid) |
---|
137 | #ifdef NC_DOUBLE |
---|
138 | ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid) |
---|
139 | #else |
---|
140 | ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid) |
---|
141 | #endif |
---|
142 | ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north") |
---|
143 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
144 | . "North latitude") |
---|
145 | ierr = NF_ENDDEF(nid) |
---|
146 | #ifdef NC_DOUBLE |
---|
147 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180) |
---|
148 | #else |
---|
149 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180) |
---|
150 | #endif |
---|
151 | c |
---|
152 | c -------------------------- |
---|
153 | ierr = NF_REDEF (nid) |
---|
154 | #ifdef NC_DOUBLE |
---|
155 | ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid) |
---|
156 | #else |
---|
157 | ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid) |
---|
158 | #endif |
---|
159 | ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, |
---|
160 | . "East longitude") |
---|
161 | ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east") |
---|
162 | ierr = NF_ENDDEF(nid) |
---|
163 | #ifdef NC_DOUBLE |
---|
164 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180) |
---|
165 | #else |
---|
166 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180) |
---|
167 | #endif |
---|
168 | c |
---|
169 | |
---|
170 | !------------------------------- |
---|
171 | ! Number of bands in the IR |
---|
172 | !------------------------------- |
---|
173 | |
---|
174 | ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
175 | ! define variable |
---|
176 | #ifdef NC_DOUBLE |
---|
177 | ierr=NF_DEF_VAR(nid,"IR Wavenumber",NF_DOUBLE,1, |
---|
178 | . idim_bandsIR,nvarid) |
---|
179 | #else |
---|
180 | ierr=NF_DEF_VAR(nid,"IR Wavenumber",NF_FLOAT,1, |
---|
181 | . idim_bandsIR,nvarid) |
---|
182 | #endif |
---|
183 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 34, |
---|
184 | . "Band mid frequency in the infrared") |
---|
185 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1") |
---|
186 | ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
187 | ! write variable |
---|
188 | #ifdef NC_DOUBLE |
---|
189 | ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WNOI)) |
---|
190 | #else |
---|
191 | ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WNOI)) |
---|
192 | #endif |
---|
193 | |
---|
194 | !------------------------------- |
---|
195 | ! Width of bands in the IR |
---|
196 | !------------------------------- |
---|
197 | |
---|
198 | ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode |
---|
199 | ! define variable |
---|
200 | #ifdef NC_DOUBLE |
---|
201 | ierr=NF_DEF_VAR(nid,"IR Bandwidth",NF_DOUBLE,1, |
---|
202 | . idim_bandsIR,nvarid) |
---|
203 | #else |
---|
204 | ierr=NF_DEF_VAR(nid,"IR Bandwidth",NF_FLOAT,1, |
---|
205 | . idim_bandsIR,nvarid) |
---|
206 | #endif |
---|
207 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 25, |
---|
208 | . "Bandwidth in the infrared") |
---|
209 | ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1") |
---|
210 | ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode |
---|
211 | ! write variable |
---|
212 | #ifdef NC_DOUBLE |
---|
213 | ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(DWNI)) |
---|
214 | #else |
---|
215 | ierr=NF_PUT_VAR_REAL (nid,nvarid,real(DWNI)) |
---|
216 | #endif |
---|
217 | c |
---|
218 | c -------------------------- |
---|
219 | c Mesh area and conversion coefficients cov. <-> contra. <--> natural |
---|
220 | |
---|
221 | |
---|
222 | id(1)=idim_rlonv |
---|
223 | id(2)=idim_rlatu |
---|
224 | c |
---|
225 | c -------------------------- |
---|
226 | ierr = NF_REDEF (nid) |
---|
227 | #ifdef NC_DOUBLE |
---|
228 | ierr = NF_DEF_VAR (nid, "aire", NF_DOUBLE, 2, id,nvarid) |
---|
229 | #else |
---|
230 | ierr = NF_DEF_VAR (nid, "aire", NF_FLOAT, 2, id,nvarid) |
---|
231 | #endif |
---|
232 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
233 | . "Mesh area") |
---|
234 | ierr = NF_ENDDEF(nid) |
---|
235 | #ifdef NC_DOUBLE |
---|
236 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
237 | #else |
---|
238 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
239 | #endif |
---|
240 | |
---|
241 | |
---|
242 | END |
---|