root/misc/StationData/make_images.pro

Revision 806, 2.8 kB (checked in by mankoff, 11 months ago)

GISTEMP

Line 
1pro make_images
2
3; ToDo:
4; add JJA, DJF line for +- 23.5 degrees (swap in south). Color blue + red
5
6; file = 'v2.temperature.inv.txt'
7; ;               012  7   10      42   48   56
8; fmt = '          A3, A5, A3,     A32, F7.2,F8.2,I5, I4,  A1,I5, A2,A2,A2,I2,A1,I2,A16,A1'
9; readfmt,file,fmt,icc,wmo,wmo_mod,name,lat, lon, ele,tele,p, pop,tp,v, lo,co,a, ds,veg,bi,skipline=38
10; save, icc,wmo,wmo_mod,name,lat,lon,ele,tele,p,pop,tp,v,lo,co,a,ds,veg,bi
11restore
12name = STRCOMPRESS(name)
13restore, 'data_struct.sav'
14
15cred = 253
16cblue = 10
17
18;for i=0,n_elements(icc)-1 do begin
19for i=5000,5010 do begin
20    idx =  where( s.icc eq icc[i] AND $
21                  s.wmo eq wmo[i] AND $
22                  s.wmo_mod eq wmo_mod[i], count )
23    if count eq 0 then continue
24    station = icc[i] + wmo[i] + wmo_mod[i]
25   
26    set_plot,'ps'
27    device, /color, bits=8
28   
29    ; get the min/max of all the temperatures, so we can pre-set the Y range
30    t_all = [[s[idx].jja,s[idx].djf,s[idx].ann]]
31    gd = where( t_all ne 999.90 AND t_all NE 0, cnt )
32    if cnt eq 0 then continue
33    trange = minmax(t_all[gd])
34
35    ; plot annual data
36    plotg, s[idx].year[gd], s[idx].ann[gd], $
37           /yno, yrange=trange, $
38           xrange=[1880,2010], /xst,psym=2, xminor=2, $
39           xtitle='Time (Years)', ytitle='Temperature (Degrees C)', $
40           chars=1.2, charth=3, title=name[i]
41   
42    ; 1st order fit to ANN
43    gd = where( s[idx].ann ne 999.90 AND s[idx].year NE 0 )
44    line = indgen(n_elements(s[idx].year))
45    r1 = poly_fit( line[gd], s[idx].ann[gd], 1 )
46    fit1 = r1[0] + r1[1]*line
47    oplot, s[idx].year[gd], fit1[gd], color=0
48   
49    ; if non-tropical, then 1st order fit to JJA and DJF
50     if abs( lat[i] ) GE 23.26 then begin
51        ; 1st order fit to JJA
52        gd = where( s[idx].JJA ne 999.90 AND s[idx].year NE 0, count )
53        if count ne 0 then begin
54            r1 = poly_fit( line[gd], s[idx].jja[gd], 1 )
55            fit1 = r1[0] + r1[1]*line
56            color=(lat[i] ge 0)? cred: cblue
57            oplot, s[idx].year[gd], s[idx].JJA[gd], color=color, psym=2, th=2
58            oplot, s[idx].year[gd], fit1[gd], color=color, thick=2
59        endif
60        ; 1st order fit to DJF
61        gd = where( s[idx].DJF ne 999.90 AND s[idx].year NE 0, count )
62        if count ne 0 then begin
63            r1 = poly_fit( line[gd], s[idx].djf[gd], 1 )
64            fit1 = r1[0] + r1[1]*line
65            color=(lat[i] lt 0)? cred: cblue
66            oplot, s[idx].year[gd], s[idx].DJF[gd], color=color, psym=2, th=2
67            oplot, s[idx].year[gd], fit1[gd], color=color, thick=2
68       endif
69    endif
70
71;     r2 = poly_fit( line[gd], ann[gd], 2 )
72;     fit2 = r2[0]+r2[1]*line+r2[2]*line^2
73;     oplot, year, fit2, color=254
74   
75    device,/close
76    set_plot,'x'
77    spawn, 'convert idl.ps  ./images/' + station + '.png'
78;    spawn, 'open ./images/' + station + '.png'
79endfor
80
81end
82
83make_images
84end
Note: See TracBrowser for help on using the browser.