source: trunk/mesoscale/PLOT/SPEC/MAP/map_uvt.pro @ 91

Last change on this file since 91 was 91, checked in by aslmd, 14 years ago

mars: test outliers [dans initracer.F, commente] LMD_MM_MARS: modifications mineures [retrocompatibilite ancienne physique, callphys.def test pour nouvelle physique] PLOT: generalisation de la routine map_uvt pour pouvoir tracer des figures en projection polaire complete

File size: 7.3 KB
Line 
1pro map_uvt
2;
3;
4;
5what_I_plot=0.
6overcontour=0
7no3d='true'
8@map_uvt_inc.pro
9SPAWN, '\rm param_plot.idl ; cp map_uvt_inc.pro param_plot.idl ; cp -f map_uvt_inc.pro '+save_ps+'.map_uvt_inc.pro'
10if (n_elements(coord2d) eq 0) then coord2d='false'
11;
12;
13;
14if (n_elements(field1) ne 0) then getcdf, file=filename, charvar=field1, invar=cfield1
15if (n_elements(field2) ne 0) then getcdf, file=filename, charvar=field2, invar=cfield2
16if ( (n_elements(overvector_x) ne 0) or (n_elements(field1) eq 0) ) then begin
17   u = getget(filename, 'Um', count=[0,0,1,1], offset=[0,0,nlevel,0])
18   v = getget(filename, 'Vm', count=[0,0,1,1], offset=[0,0,nlevel,0])
19endif
20getcdf, file=filename, charvar='XLONG', invar=longi
21getcdf, file=filename, charvar='XLAT', invar=lati
22getcdf, file=filename, charvar='HGT', invar=hgt
23;
24;
25;
26sp = 5 ;; relaxation width
27nx = n_elements(longi(0,*))
28ny = n_elements(longi(*,0))
29if (n_elements(field1) ne 0) then begin
30        if (no3d ne 'true') then cfield1 = cfield1 (sp:nx-sp-1,sp:ny-sp-1,*,*) else cfield1 = cfield1 (sp:nx-sp-1,sp:ny-sp-1,*)
31endif
32if (n_elements(field2) ne 0) then begin
33        if (no3d ne 'true') then cfield2 = cfield2 (sp:nx-sp-1,sp:ny-sp-1,*,*) else cfield2 = cfield2 (sp:nx-sp-1,sp:ny-sp-1,*)
34endif
35if ( (n_elements(overvector_x) ne 0) or (n_elements(field1) eq 0) ) then begin
36  u             = u             (sp:nx-sp-1,sp:ny-sp-1,*)
37  v             = v             (sp:nx-sp-1,sp:ny-sp-1,*)
38endif
39longi           = longi         (sp:nx-sp-1,sp:ny-sp-1,*)
40lati            = lati          (sp:nx-sp-1,sp:ny-sp-1,*)
41hgt             = hgt           (sp:nx-sp-1,sp:ny-sp-1,*)
42nx = n_elements(longi(*,0,0))
43ny = n_elements(longi(0,*,0))
44nt = n_elements(longi(0,0,*))
45if ( n_elements( overvector_x ) ne 0 ) then begin 
46  overvector_x = u
47  overvector_y = v
48endif
49;
50;
51;
52                if (ntime eq 99) then begin
53                        PRINT, '-- ALL TIME STEPS', nt-1
54                        ntstart = 0  & ntend = nt-1
55                endif else begin
56                        PRINT, '-- ONLY TIME STEP ', string(ntime,'(I0)')
57                        ntstart = ntime & ntend = ntime
58                endelse
59                for ntime = ntstart,ntend do begin
60;
61;
62;
63  zefile=save_ps+string(100+ntime,'(I0)')
64  PS_Start, filename=zefile+'.ps'
65  print, zefile+'.ps'
66  !P.Charsize = 1.2
67  !p.charthick = 2.0
68  !p.thick = 2.0
69  !x.thick = 2.0
70  !y.thick = 2.0
71;
72;
73;
74lon = reform(longi(*,*,ntime))
75lat = reform(lati(*,*,ntime))
76if (n_elements(field1) eq 0) then begin
77        print, 'field1: horizontal velocity'
78        zevel = overvector_x^2 + overvector_y^2  ;; attention il faut que les tableaux soient de la meme taille, OK si uvmet
79        what_I_plot = sqrt(zevel)
80endif else begin
81        if (no3d ne 'true') then what_I_plot = reform(cfield1(*,*,nlevel,ntime)) else what_I_plot = reform(cfield1(*,*,ntime))
82        if (n_elements(u) ne 0) then overvector_x = reform(overvector_x(*,*,ntime))   ;; ne pas utiliser test overvector_x a cause de la boucle temps
83        if (n_elements(v) ne 0) then overvector_y = reform(overvector_y(*,*,ntime))   ;; ne pas utiliser test overvector_y a cause de la boucle temps
84endelse
85if (n_elements(field2) eq 0) then begin
86        print, 'field2: topography'
87        overcontour = reform(hgt(*,*,ntime))
88endif else begin
89        if (no3d ne 'true') then overcontour = reform(cfield2(*,*,nlevel,ntime)) else overcontour = reform(cfield2(*,*,ntime))
90endelse
91;
92;
93;
94if ( coord2d eq 'polar' ) then begin
95   print, 'OK YOU USE MAP_SET with POLAR PROJECTION. VECTORS ARE NOT SUPPORTED. USE polar_uv OR ADAPT THIS SCRIPT.'
96   overvector_x = 0
97   overvector_y = 0
98   if (n_elements(windowx) ne 0) then begin
99       latmin = windowy(0) & latmax = windowy(1) & lonmin = windowx(0) & lonmax = windowx(1)
100   endif else begin
101       latmin = 65. & latmax = 90. & lonmin = -180. & lonmax = 180.
102   endelse
103   print, 'latmin,lonmin,latmax,lonmax', latmin,lonmin,latmax,lonmax
104   map_set, latmax, 0., /isotropic, /azimuthal, /noborder, limit=[latmin,lonmin,latmax,lonmax], title=title_user, /advance
105endif else begin
106  minlat=min(lat) & maxlat=max(lat) & minlon=min(lon) & maxlon=max(lon)
107  if (coord2d eq 'true') then begin
108        npoints=n_elements(lon(*,0)) + n_elements(lon(0,*))  ;; trop de points, mais au moins on ne perd rien
109        TRIANGULATE, lon, lat, tr
110        what_I_plot  = GRIDDATA( lon, lat, what_I_plot,  /LINEAR, triangles=tr, dimension=npoints, MISSING=!VALUES.F_NAN )
111        if (n_elements(overvector_x) ne 0) then begin
112          overvector_x = GRIDDATA( lon, lat, overvector_x, /LINEAR, triangles=tr, dimension=npoints, MISSING=!VALUES.F_NAN )
113          overvector_y = GRIDDATA( lon, lat, overvector_y, /LINEAR, triangles=tr, dimension=npoints, MISSING=!VALUES.F_NAN )
114        endif
115        overcontour  = GRIDDATA( lon, lat, overcontour,  /LINEAR, triangles=tr, dimension=npoints, MISSING=!VALUES.F_NAN )
116                        if (n_elements(overvector_x) ne 0) then begin
117                          ; sale sale sale
118                          if (minlat lt min(lat(*,0))) then overvector_y=-overvector_y
119                          if (minlon lt min(lon(0,*))) then overvector_x=-overvector_x
120                        endif
121        lon =  minlon + (maxlon - minlon)*findgen(npoints)/float(npoints-1)
122        lat =  minlat + (maxlat - minlat)*findgen(npoints)/float(npoints-1)
123  endif else begin
124        lon = reform(lon(*,0))
125        lat = reform(lat(0,*))
126        ;npoints=n_elements(lon(*,0)) + n_elements(lon(0,*))
127        ;what_I_plot = REBIN( what_I_plot, npoints, npoints )
128        ;overvector_x = REBIN( overvector_x, npoints, npoints )
129        ;overvector_y = REBIN( overvector_y, npoints, npoints )
130        ;overcontour = REBIN( overcontour, npoints, npoints )
131        ;lon =  minlon + (maxlon - minlon)*findgen(npoints)/float(npoints-1)
132        ;lat =  minlat + (maxlat - minlat)*findgen(npoints)/float(npoints-1)
133  endelse
134endelse
135help, what_I_plot, lon, lat
136print, min(what_I_plot)
137print, max(what_I_plot)
138print, min(overcontour)
139print, max(overcontour)
140;
141;
142;
143map_latlon, $
144        what_I_plot, $                          ; 2D field
145        lon, $                                  ; 1D latitude
146        lat, $                                  ; 1D longitude
147        minfield=minfield_init, $               ; minimum value of plotted field (=0: calculate)
148        maxfield=maxfield_init, $               ; maximum value of plotted field (=0: calculate)
149        overcontour=overcontour, $              ; another 2D field to overplot with contour lines (=0: no)
150        overvector_x=overvector_x, $            ; wind vector - x component (=0: no)
151        overvector_y=overvector_y, $            ; wind vector - y component (=0: no)
152        ct=pal, $                               ; color table (33-rainbow is default)
153        colors=colors, $                        ; number of colors/levels (32 is default)
154        title=title_user, $                     ; title of the plot ('' is default)
155        format=format                           ; format of colorbar annotations ('(F6.2)' is default)
156;
157;
158;
159if ( coord2d eq 'polar' ) then begin    ;;; pourrait aller dans map_latlon
160  loadct, 0
161  MAP_GRID, $
162          CHARSIZE = 1., $
163          COLOR    = 0,   $
164          ;lats=-60, $
165          LABEL    = 1,   $   ;; /LABEL or LABEL=2 (one label any 2 grid lines)
166          LATDEL   = intervaly, $   ;;5 10
167          LONDEL   = intervalx, $   ;;15
168          LONLAB   = latmin + intervaly/2., $ ;5. + (latmin+latmax)/2., $ ;0.
169          LATLAB   = -0.001, $
170          GLINESTYLE = 2, $
171          GLINETHICK = 0.3
172          ;LONALIGN = 0., $
173          ;LATALIGN = 1.
174endif
175;
176;
177;
178PS_End, /PNG
179                endfor
180end
Note: See TracBrowser for help on using the repository browser.