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