source: trunk/INTERP2/make_geogrid.pro @ 2

Last change on this file since 2 was 2, checked in by pinsard, 18 years ago

initial import from /usr/work/fvi/OPA/geomag/

File size: 17.7 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;
5; NAME: make_geogrid.pro
6;
7; PURPOSE: Creates for a given ORCA grid, ORCA_GEO which is
8; the closest geographical grid to this ORCA grid
9;
10; CATEGORY : Subroutine
11;
12; CALLING SEQUENCE : make_geogrid
13;
14; INPUTS :
15;         All the variables of a given ORCA meshmask file
16; OUTPUTS :
17;         A netcdf format meshmask file that has the same size as the
18;         one given in input and contains exactly the same variable,
19;         although they describe another grid.
20;
21; COMMON BLOCKS:
22;         None
23;
24; SIDE EFFECTS:
25;
26; RESTRICTIONS:
27;
28; EXAMPLE:
29;
30; MODIFICATION HISTORY: 08/2002 Robinson Hordoir
31;
32;------------------------------------------------------------
33;------------------------------------------------------------
34;------------------------------------------------------------
35
36
37pro make_geogrid
38
39@initorca
40@init_path2
41@naminterp2
42
43;------------------------------------------------------------
44; Creation of a regular grid based on a given ORCA grid
45;------------------------------------------------------------
46
47
48;******************************************
49; 0. DEFINE OUTPUT VALUES
50;******************************************
51
52
53; Output values are set to input values
54
55  glamt_reg=glamt
56  glamu_reg=glamu
57  glamv_reg=glamv
58  glamf_reg=glamf
59
60  gphit_reg=gphit
61  gphiu_reg=gphiu
62  gphiv_reg=gphiv
63  gphif_reg=gphif
64
65  e1t_reg=e1t
66  e1u_reg=e1u
67  e1v_reg=e1v
68  e1f_reg=e1f
69
70  e2t_reg=e2t
71  e2u_reg=e2u
72  e2v_reg=e2v
73  e2f_reg=e2f
74 
75  tmask_reg=tmask
76  umask_reg=tmask
77  vmask_reg=tmask
78  fmask_reg=tmask
79
80
81;*****************************************************************
82; 1. FIRST STEP : DEFINE  THE LATITUDE, LONGITUDE & SCALE FACTORS
83;*****************************************************************
84
85; Let's get our reference latitude. Search for northernmost place
86; of the ORCA grid that is still geographical
87
88northernmost=where(gphit EQ max(gphit))
89
90jnorth=northernmost/jpi
91
92inorth=min(northernmost-jnorth*jpi)
93
94ref_latitude=gphit(inorth,*)
95
96; Let's get the reference longitude
97
98equador=where(abs(gphit) EQ  min(abs(gphit)) )
99
100ref_longitude=glamt(equador)
101
102; Duplication for all T points
103
104glamt_reg=ref_longitude#replicate(1,n_elements(ref_latitude))
105
106
107gphit_reg=replicate(1,n_elements(ref_longitude))#ref_latitude
108
109; COMPUTATION OF LONGITUDES AND LATITUDES AT ALL POINTS
110
111; From this we can deduce glamu_reg and gphiu_reg
112
113glamu_reg=glamt_reg+grid_def/2.
114gphiu_reg=gphit_reg
115
116; As well as glamv_reg and gphiv_reg
117
118glamv_reg=glamt_reg
119gphiv_reg=gphit_reg+(gphit_reg-shift(gphit_reg,0,-1))/2.
120gphiv_reg(*,jpj-1)=gphit_reg(*,jpj-1)+(gphit_reg(*,jpj-1)-gphit_reg(*,jpj-2))/2.
121
122; Same thing for glamf_reg and gphif_reg
123
124glamf_reg=glamu_reg
125gphif_reg=gphiv_reg
126
127
128; COMPUTATION OF SCALE FACTORS
129
130
131
132; Scale factor at equator
133
134eq_j=where(gphit(inorth,*) EQ 0.)
135
136e1t_eq=e1t(*,eq_j)
137
138; E1t scale factor
139
140e1t_reg=( e1t_eq#replicate(1.,jpj) )*(replicate(1.,jpi)#cos(!PI*gphit(inorth,*)/180.))
141
142
143; E2t scale factor
144
145e2t_reg=replicate(1.,jpi)#e2t(inorth,*)
146
147
148; E1u scale factor
149; e1u_reg=e1t_reg because the grid is fully regular along x axis
150; Same remark for e2u
151
152e1u_reg=e1t_reg
153e2u_reg=e2t_reg
154
155;E1v scale factor
156
157e1v_reg=( e1t_eq#replicate(1.,jpj) )*(replicate(1.,jpi)#cos(!PI*gphiv(inorth,*)/180.))
158
159; E2v scale factor
160
161e2v_reg=replicate(1.,jpi)#e2v(inorth,*)
162
163;E1f scale factor
164
165e1f_reg=( e1t_eq#replicate(1.,jpj) )*(replicate(1.,jpi)#cos(!PI*gphit(inorth,*)/180.))
166
167;E2f scale factor
168
169e2f_reg=replicate(1.,jpi)#e2f(inorth,*)
170
171
172;************************************************
173;  2nd STEP : Define the mask of the outpût grid
174;************************************************
175
176
177; We now need to define the grid mask...
178
179
180mask_reg=tmask
181
182; Let's get entire coordinates of meshmask
183
184
185sph_coord=replicate(1.,3,jpi*jpj)
186
187; We put some crazy values of radius on half of the North Fold line in order
188; to avoid any problem
189
190sph_coord(2,jpj*jpi-1-jpi/2:jpj*jpi-1)=10.
191
192sph_coord(0,*)=reform(glamt,jpi*jpj)
193sph_coord(1,*)=reform(gphit,jpi*jpj)
194
195rec_grid=cv_coord(/DEGREES,FROM_SPHERE=sph_coord,/TO_RECT)
196
197xx_grid=rec_grid(0,*)
198yy_grid=rec_grid(1,*)   
199zz_grid=rec_grid(2,*)
200 
201
202not_found=1
203for jj=0, jpj-1 do begin
204
205   lat_max_ORCA=max( gphit(*,jj)     )
206   lat_max_reg =max( gphit_reg(*,jj) )
207
208
209   if ((lat_max_ORCA NE lat_max_reg) AND (not_found EQ 1)) then begin
210   jpj_start=jj-2
211   not_found=0
212   endif
213
214end
215
216
217
218; Loop on all elements of our geo grid
219
220for jj=jpj/2,jpj-1 do begin
221    for ji=0,jpi-1 do begin
222   
223
224; Coordinates of our point
225
226    xx=glamt_reg(ji,jj)
227    yy=gphit_reg(ji,jj)
228   
229    sph_coord=replicate(1.,3)
230    sph_coord(0)=xx
231    sph_coord(1)=yy
232
233; Convert them into cartesian
234   
235    rec_coord=cv_coord(/DEGREES,FROM_SPHERE=sph_coord,/TO_RECT)
236
237    xx_bis=replicate(rec_coord(0),jpi*jpj)
238    yy_bis=replicate(rec_coord(1),jpi*jpj)
239    zz_bis=replicate(rec_coord(2),jpi*jpj)
240
241    modules=sqrt((xx_grid-xx_bis)*(xx_grid-xx_bis)  $
242                +(yy_grid-yy_bis)*(yy_grid-yy_bis)  $
243                +(zz_grid-zz_bis)*(zz_grid-zz_bis))
244   
245
246    sort_mod=where(modules EQ min(modules))
247
248    answj=sort_mod(0)/jpi   
249
250    answi=sort_mod(0)-answj*jpi
251
252
253    mask_reg(ji,jj,*)=tmask(answi,answj,*)
254   
255 
256    endfor
257endfor
258
259;*****************************************
260; 3rd STEP : PUT VALUES INTO ATTRIBUTES
261;*****************************************
262
263;********** T MASK*********************
264
265; Create Global Mask file for T point
266
267    tmask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
268
269    tmask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=mask_reg
270
271
272; Data Duplication
273
274; North
275
276    tmask_reg_glo(*,jpjglo-1,*)=tmask_reg_glo(*,jpjglo-2,*)
277;E/W
278
279    tmask_reg_glo(0,*,*)=tmask_reg_glo(jpiglo-2,*,*)
280    tmask_reg_glo(jpiglo-1,*,*)=tmask_reg_glo(1,*,*)
281
282; Global T mask in created
283
284; Creates U mask, V mask and F mask
285
286
287   umask_reg=tmask_reg_glo(1:jpiglo-2,0:jpjglo-2,*)*tmask_reg_glo(2:jpiglo-1,0:jpjglo-2,*)
288
289   vmask_reg=tmask_reg_glo(1:jpiglo-2,0:jpjglo-2,*)*tmask_reg_glo(1:jpiglo-2,1:jpjglo-1,*)
290
291   fmask_reg=tmask_reg_glo(1:jpiglo-2,0:jpjglo-2,*)*tmask_reg_glo(2:jpiglo-1,0:jpjglo-2,*) $
292            *tmask_reg_glo(1:jpiglo-2,1:jpjglo-1,*)*tmask_reg_glo(2:jpiglo-1,1:jpjglo-1,*)
293
294; Create Global Mask file for U,V & F points
295
296    umask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
297    umask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=umask_reg
298
299    vmask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
300    vmask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=vmask_reg
301
302    fmask_reg_glo=replicate(0.,jpiglo,jpjglo,jpk)
303    fmask_reg_glo(1:jpiglo-2,0:jpjglo-2, *)=fmask_reg
304
305; Data Duplication
306
307; North
308
309    umask_reg_glo(*,jpjglo-1,*)=umask_reg_glo(*,jpjglo-2,*)
310    vmask_reg_glo(*,jpjglo-1,*)=vmask_reg_glo(*,jpjglo-2,*)
311    fmask_reg_glo(*,jpjglo-1,*)=fmask_reg_glo(*,jpjglo-2,*)
312
313;E/W
314
315    umask_reg_glo(0,*,*)=umask_reg_glo(jpiglo-2,*,*)
316    umask_reg_glo(jpiglo-1,*,*)=umask_reg_glo(1,*,*)
317
318    vmask_reg_glo(0,*,*)=vmask_reg_glo(jpiglo-2,*,*)
319    vmask_reg_glo(jpiglo-1,*,*)=vmask_reg_glo(1,*,*)
320
321    fmask_reg_glo(0,*,*)=fmask_reg_glo(jpiglo-2,*,*)
322    fmask_reg_glo(jpiglo-1,*,*)=fmask_reg_glo(1,*,*)
323
324; ***** NAV_LON & NAV_LAT **********
325
326
327; Create Global longitude and latitude
328
329    glamt_reg_glo=replicate(0.,jpiglo,jpjglo)
330
331    glamt_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamt_reg
332
333    gphit_reg_glo=replicate(0.,jpiglo,jpjglo)
334
335    gphit_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphit_reg
336
337    nav_lon_reg_glo=replicate(0.,jpiglo,jpjglo)
338
339    nav_lat_reg_glo=replicate(0.,jpiglo,jpjglo)
340
341    nav_lon_reg_glo=glamt_reg_glo
342
343    nav_lat_reg_glo=gphit_reg_glo
344
345; Data Duplication
346
347; E/W Transition
348
349    nav_lon_reg_glo(0,*)=nav_lon_reg_glo(jpiglo-2,*)
350    nav_lon_reg_glo(jpiglo-1,*)=nav_lon_reg_glo(1,*)
351
352    nav_lat_reg_glo(0,*)=nav_lat_reg_glo(jpiglo-2,*)
353    nav_lat_reg_glo(jpiglo-1,*)=nav_lat_reg_glo(1,*)
354
355; North
356
357    nav_lon_reg_glo(*,jpjglo-1)= nav_lon_reg_glo(*,jpjglo-2)
358    nav_lat_reg_glo(*,jpjglo-1)= nav_lat_reg_glo(*,jpjglo-2)
359
360; ***** GLAMT *****
361; We don't do it to save memory :  same as nav_lon
362
363; ***** GLAMU *****
364
365    glamu_reg_glo=replicate(0.,jpiglo,jpjglo)
366    glamu_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamu_reg
367
368; North
369
370    glamu_reg_glo(*,jpjglo-1)=glamu_reg_glo(*,jpjglo-2)
371   
372; E/W
373 
374    glamu_reg_glo(0,*)=glamu_reg_glo(jpiglo-2,*)
375    glamu_reg_glo(jpiglo-1,*)=glamu_reg_glo(1,*)
376   
377; ***** GLAMV *****
378
379    glamv_reg_glo=replicate(0.,jpiglo,jpjglo)
380    glamv_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamv_reg
381
382; North
383
384    glamv_reg_glo(*,jpjglo-1)=glamv_reg_glo(*,jpjglo-2)
385   
386; E/W
387 
388    glamv_reg_glo(0,*)=glamv_reg_glo(jpiglo-2,*)
389    glamv_reg_glo(jpiglo-1,*)=glamv_reg_glo(1,*)
390
391
392; ***** GLAMF *****
393
394    glamf_reg_glo=replicate(0.,jpiglo,jpjglo)
395    glamf_reg_glo(1:jpiglo-2,0:jpjglo-2)=glamf_reg
396
397; North
398
399    glamf_reg_glo(*,jpjglo-1)=glamf_reg_glo(*,jpjglo-2)
400   
401; E/W
402 
403    glamf_reg_glo(0,*)=glamf_reg_glo(jpiglo-2,*)
404    glamf_reg_glo(jpiglo-1,*)=glamf_reg_glo(1,*)
405
406
407; ***** GPHIT *****
408; We don't do it to save memory :  same as nav_lat
409
410; ***** GPHIU *****
411
412    gphiu_reg_glo=replicate(0.,jpiglo,jpjglo)
413    gphiu_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphiu_reg
414
415; North
416
417    gphiu_reg_glo(*,jpjglo-1)=gphiu_reg_glo(*,jpjglo-2)
418   
419; E/W
420 
421    gphiu_reg_glo(0,*)=gphiu_reg_glo(jpiglo-2,*)
422    gphiu_reg_glo(jpiglo-1,*)=gphiu_reg_glo(1,*)
423   
424; ***** GPHIV *****
425
426    gphiv_reg_glo=replicate(0.,jpiglo,jpjglo)
427    gphiv_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphiv_reg
428
429; North
430
431    gphiv_reg_glo(*,jpjglo-1)=gphiv_reg_glo(*,jpjglo-2)
432   
433; E/W
434 
435    gphiv_reg_glo(0,*)=gphiv_reg_glo(jpiglo-2,*)
436    gphiv_reg_glo(jpiglo-1,*)=gphiv_reg_glo(1,*)
437
438
439; ***** GPHIF *****
440
441    gphif_reg_glo=replicate(0.,jpiglo,jpjglo)
442    gphif_reg_glo(1:jpiglo-2,0:jpjglo-2)=gphif_reg
443
444; North
445
446    gphif_reg_glo(*,jpjglo-1)=gphif_reg_glo(*,jpjglo-2)
447   
448; E/W
449 
450    gphif_reg_glo(0,*)=gphif_reg_glo(jpiglo-2,*)
451    gphif_reg_glo(jpiglo-1,*)=gphif_reg_glo(1,*)
452
453; ***** FF *******
454
455    omega = 2.0 * !PI / 86164.0
456   
457    ff_reg_glo = 2.*omega*sin(gphif_reg_glo*!PI/180.)
458   
459
460; *********** E1T***************
461   
462    e1t_reg_glo=replicate(0.,jpiglo,jpjglo)
463    e1t_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1t_reg
464
465; North
466
467    e1t_reg_glo(*,jpjglo-1)=e1t_reg_glo(*,jpjglo-2)
468   
469; E/W
470 
471    e1t_reg_glo(0,*)=e1t_reg_glo(jpiglo-2,*)
472    e1t_reg_glo(jpiglo-1,*)=e1t_reg_glo(1,*)
473
474
475
476; *********** E2T***************
477   
478    e2t_reg_glo=replicate(0.,jpiglo,jpjglo)
479    e2t_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2t_reg
480
481; North
482
483    e2t_reg_glo(*,jpjglo-1)=e2t_reg_glo(*,jpjglo-2)
484   
485; E/W
486 
487    e2t_reg_glo(0,*)=e2t_reg_glo(jpiglo-2,*)
488    e2t_reg_glo(jpiglo-1,*)=e2t_reg_glo(1,*)
489
490; *********** E1U***************
491   
492    e1u_reg_glo=replicate(0.,jpiglo,jpjglo)
493    e1u_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1u_reg
494
495; North
496
497    e1u_reg_glo(*,jpjglo-1)=e1u_reg_glo(*,jpjglo-2)
498   
499; E/W
500 
501    e1u_reg_glo(0,*)=e1u_reg_glo(jpiglo-2,*)
502    e1u_reg_glo(jpiglo-1,*)=e1u_reg_glo(1,*)
503
504
505; *********** E2U***************
506   
507    e2u_reg_glo=replicate(0.,jpiglo,jpjglo)
508    e2u_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2u_reg
509
510; North
511
512    e2u_reg_glo(*,jpjglo-1)=e2u_reg_glo(*,jpjglo-2)
513   
514; E/W
515 
516    e2u_reg_glo(0,*)=e2u_reg_glo(jpiglo-2,*)
517    e2u_reg_glo(jpiglo-1,*)=e2u_reg_glo(1,*)
518
519; *********** E1V***************
520   
521    e1v_reg_glo=replicate(0.,jpiglo,jpjglo)
522    e1v_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1v_reg
523
524; North
525
526    e1v_reg_glo(*,jpjglo-1)=e1v_reg_glo(*,jpjglo-2)
527   
528; E/W
529 
530    e1v_reg_glo(0,*)=e1v_reg_glo(jpiglo-2,*)
531    e1v_reg_glo(jpiglo-1,*)=e1v_reg_glo(1,*)
532
533; *********** E2V***************
534   
535    e2v_reg_glo=replicate(0.,jpiglo,jpjglo)
536    e2v_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2v_reg
537
538; North
539
540    e2v_reg_glo(*,jpjglo-1)=e2v_reg_glo(*,jpjglo-2)
541   
542; E/W
543 
544    e2v_reg_glo(0,*)=e2v_reg_glo(jpiglo-2,*)
545    e2v_reg_glo(jpiglo-1,*)=e2v_reg_glo(1,*)
546
547; *********** E1F **************
548
549    e1f_reg_glo=replicate(0.,jpiglo,jpjglo)
550    e1f_reg_glo(1:jpiglo-2,0:jpjglo-2)=e1f_reg
551
552; North
553
554    e1f_reg_glo(*,jpjglo-1)=e1f_reg_glo(*,jpjglo-2)
555   
556; E/W
557 
558    e1f_reg_glo(0,*)=e1f_reg_glo(jpiglo-2,*)
559    e1f_reg_glo(jpiglo-1,*)=e1f_reg_glo(1,*)
560
561; *********** E2F***************
562   
563    e2f_reg_glo=replicate(0.,jpiglo,jpjglo)
564    e2f_reg_glo(1:jpiglo-2,0:jpjglo-2)=e2f_reg
565
566; North
567
568    e2f_reg_glo(*,jpjglo-1)=e2f_reg_glo(*,jpjglo-2)
569   
570; E/W
571 
572    e2f_reg_glo(0,*)=e2f_reg_glo(jpiglo-2,*)
573    e2f_reg_glo(jpiglo-1,*)=e2f_reg_glo(1,*)
574
575
576
577;****************END OF ATTRIBUTES****************
578
579 
580;*************************************************
581; 4th STEP : CREATES NCDF MESHMASK FILE
582;*************************************************
583
584; Creates Netcdf File to save this
585
586
587   vargrid = 'T'
588
589; Name
590   idout = NCDF_CREATE(outputgrid,/clobber)
591   print, 'Creation du fichier Netcdf'
592   NCDF_CONTROL, idout, /nofill
593; Dimension
594
595   xidout = NCDF_DIMDEF(idout, 'x', jpiglo)
596   yidout = NCDF_DIMDEF(idout, 'y', jpjglo)
597   didout = NCDF_DIMDEF(idout, 'z', jpk)
598   x_a    = NCDF_DIMDEF(idout, 'x_a',1)
599   y_a    = NCDF_DIMDEF(idout, 'y_a',1)
600   z_a    = NCDF_DIMDEF(idout, 'z_a',1)
601   tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited)
602
603; Attributes
604     
605   id0  = NCDF_VARDEF(idout, 'nav_lon'     , [xidout, yidout                ],/FLOAT )
606   id1  = NCDF_VARDEF(idout, 'nav_lat'     , [xidout, yidout                ],/FLOAT )
607   id2  = NCDF_VARDEF(idout, 'nav_lev'     , [                didout        ],/FLOAT )
608   id3  = NCDF_VARDEF(idout, 'time'        , [                        tidout],/FLOAT )
609   id4  = NCDF_VARDEF(idout, 'time_steps'  , [                        tidout],/LONG  )
610   id5  = NCDF_VARDEF(idout, 'glamt'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
611   id6  = NCDF_VARDEF(idout, 'glamu'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
612   id7  = NCDF_VARDEF(idout, 'glamv'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
613   id8  = NCDF_VARDEF(idout, 'glamf'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
614   id9  = NCDF_VARDEF(idout, 'gphit'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
615   id10 = NCDF_VARDEF(idout, 'gphiu'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
616   id11 = NCDF_VARDEF(idout, 'gphiv'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
617   id12 = NCDF_VARDEF(idout, 'gphif'       , [xidout, yidout, z_a   , tidout],/DOUBLE)
618   id13 = NCDF_VARDEF(idout, 'e1t'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
619   id14 = NCDF_VARDEF(idout, 'e1u'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
620   id15 = NCDF_VARDEF(idout, 'e1v'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
621   id16 = NCDF_VARDEF(idout, 'e1f'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
622   id17 = NCDF_VARDEF(idout, 'e2t'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
623   id18 = NCDF_VARDEF(idout, 'e2u'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
624   id19 = NCDF_VARDEF(idout, 'e2v'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
625   id20 = NCDF_VARDEF(idout, 'e2f'         , [xidout, yidout, z_a   , tidout],/DOUBLE)
626   id21 = NCDF_VARDEF(idout, 'tmask'       , [xidout, yidout, didout, tidout],/DOUBLE)
627   id22 = NCDF_VARDEF(idout, 'umask'       , [xidout, yidout, didout, tidout],/DOUBLE)
628   id23 = NCDF_VARDEF(idout, 'vmask'       , [xidout, yidout, didout, tidout],/DOUBLE)
629   id24 = NCDF_VARDEF(idout, 'fmask'       , [xidout, yidout, didout, tidout],/DOUBLE)
630   id25 = NCDF_VARDEF(idout, 'ff'          , [xidout, yidout, z_a   , tidout],/DOUBLE)
631   id26 = NCDF_VARDEF(idout, 'gdept'       , [x_a   , y_a   , didout, tidout],/DOUBLE)
632   id27 = NCDF_VARDEF(idout, 'gdepw'       , [x_a   , y_a   , didout, tidout],/DOUBLE)
633   id28 = NCDF_VARDEF(idout, 'e3t'         , [x_a   , y_a   , didout, tidout],/DOUBLE)
634   id29 = NCDF_VARDEF(idout, 'e3w'         , [x_a   , y_a   , didout, tidout],/DOUBLE)
635
636; Variable 0
637   NCDF_ATTPUT, idout, id0, 'units', 'degrees_east'
638   NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude'
639   NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid'
640; Variable 1
641   NCDF_ATTPUT, idout, id1, 'units', 'degrees_north'
642   NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude'
643   NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid'
644; Variable 2
645   NCDF_ATTPUT, idout, id2, 'units','meters'
646   NCDF_ATTPUT, idout, id2, 'long_name','Depth'
647   NCDF_ATTPUT, idout, id2, 'nav_model','Default grid'
648; Variable 3
649   NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-15 12:00:00 '
650   NCDF_ATTPUT, idout, id3, 'calendar','noleap'
651   NCDF_ATTPUT, idout, id3, 'title', 'Time'
652   NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis'
653   NCDF_ATTPUT, idout, id3, 'time_origin','0000-DEC-15 00:00:00'
654
655 
656   NCDF_CONTROL, idout, /ENDEF
657
658
659
660; Writting
661
662
663   NCDF_VARPUT, idout, id0 , nav_lon_reg_glo
664   NCDF_VARPUT, idout, id1 , nav_lat_reg_glo
665   NCDF_VARPUT, idout, id2 , gdept
666   NCDF_VARPUT, idout, id3 , 1.
667   NCDF_VARPUT, idout, id4 , 1.
668   NCDF_VARPUT, idout, id5 , nav_lon_reg_glo
669
670   NCDF_VARPUT, idout, id6 , glamu_reg_glo
671   NCDF_VARPUT, idout, id7 , glamv_reg_glo
672   NCDF_VARPUT, idout, id8 , glamf_reg_glo
673   NCDF_VARPUT, idout, id9 , nav_lat_reg_glo
674   NCDF_VARPUT, idout, id10, gphiu_reg_glo
675   NCDF_VARPUT, idout, id11, gphiv_reg_glo
676   NCDF_VARPUT, idout, id12, gphif_reg_glo
677   NCDF_VARPUT, idout, id13, e1t_reg_glo
678   NCDF_VARPUT, idout, id14, e1u_reg_glo
679   NCDF_VARPUT, idout, id15, e1v_reg_glo
680   NCDF_VARPUT, idout, id16, e1f_reg_glo
681   NCDF_VARPUT, idout, id17, e2t_reg_glo
682   NCDF_VARPUT, idout, id18, e2u_reg_glo
683   NCDF_VARPUT, idout, id19, e2v_reg_glo
684   NCDF_VARPUT, idout, id20, e2f_reg_glo
685   NCDF_VARPUT, idout, id21, tmask_reg_glo
686   NCDF_VARPUT, idout, id22, umask_reg_glo
687   NCDF_VARPUT, idout, id23, vmask_reg_glo
688   NCDF_VARPUT, idout, id24, fmask_reg_glo
689   NCDF_VARPUT, idout, id25, ff_reg_glo
690
691   dummy=replicate(0.,1,1,jpk,1)
692   dummy(0,0,*,0)=gdept
693
694   NCDF_VARPUT, idout, id26, dummy
695
696    dummy=replicate(0.,1,1,jpk,1)
697    dummy(0,0,*,0)=gdepw
698
699   NCDF_VARPUT, idout, id27, dummy
700
701    dummy=replicate(0.,1,1,jpk,1)
702    dummy(0,0,*,0)=e3t
703
704   NCDF_VARPUT, idout, id28, dummy
705
706    dummy=replicate(0.,1,1,jpk,1)
707    dummy(0,0,*,0)=e3w
708
709   NCDF_VARPUT, idout, id29, dummy
710
711   NCDF_CLOSE, idout
712
713   
714
715end
716
Note: See TracBrowser for help on using the repository browser.