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