source: trunk/src/q2m_correction_ncdf.pro @ 5

Last change on this file since 5 was 5, checked in by pinsard, 13 years ago

first commit with original work of Praveen

File size: 2.2 KB
Line 
1pro q2m_correction_ncdf
2@common
3;----------------------------------------------------------------------
4da1=19880101 & da2=20101231
5
6file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_q2m_19890101_20091231_oafluxgrid.nc'
7initncdf, file
8q2m=read_ncdf('q2m',da1,da2,file=file,/nostr)
9help, q2m
10
11q2m_mean=grossemoyenne(q2m,'t',/nan)
12help, q2m_mean
13;----------------------------------------------------------------------
14
15tt=time & jpt=n_elements(time)
16caldat, time,mon,day,yea
17q2m_m=q2m*0.
18
19for jt=0,jpt-1 do begin
20  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
21  q=reform(q2m_mean(*,*))
22  q2m_m(*,*,jt)=q
23endfor
24help, q2m_m
25
26q2m_ano=q2m-q2m_m
27
28;; correction for mean based on scatter
29;q2m_m=q2m_m+0.815445  ;;  (2000-2008)
30q2m_m=q2m_m+0.792717   ;;  (2000-2009)
31help, q2m_ano
32
33;; applying the correction for varyability based on the scatter
34;q2m_ano=q2m_ano*(1/0.919333)  ;;  (2000-2008)
35q2m_ano=q2m_ano*(1/0.924674)   ;;  (2000-2009)
36
37q2m_new=q2m_m+q2m_ano
38help, q2m_new
39
40;----------------------------------------------------------------------
41;writing field
42lat=reform(gphit(0,0:jpj-1))
43lon=reform(glamt(0:jpi-1,0))
44time=timegen(7670, units='days', start=julday(1,1,1989,0)) & jpt=n_elements(time)
45
46cda0=string(jul2date(time(0)),format='(i8.8)')
47cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
48
49time=time-julday(1,1,1950) & jpt=n_elements(time)
50
51ncfile='!/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_q2m_19890101_20091231_v20.nc'
52lon_attr={units:'degrees_east',long_name:'Longitude'}
53lat_attr={units:'degrees_north',long_name:'Latitude'}
54time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'}
55q2m_attr={units:'g/kg',missing_value:1.e20,long_name:'Specific humidity at 2m height',short_name:'q2m',axis:'TYX'}
56globattr={source:'Basic data obtained from ERAI.  Mean correction for bias and correction for variability are applied',timerange:cda0+' - '+cda1}
57
58
59ncfields = 'q2m[longitude,latitude,time]=q2m_new:q2m_attr; ' $
60                      + 'longitude[]=lon:lon_attr; ' $
61                      + 'latitude[]=lat:lat_attr; ' $
62                      + 'time[*time]=time:time_attr ' $
63                      + ' @ globattr'
64
65@ncdf_quickwrite
66
67end
68
69
Note: See TracBrowser for help on using the repository browser.