[6] | 1 | ;+ |
---|
| 2 | ; |
---|
| 3 | ; .. _interp_olr_30n30s_1989_2009.pro: |
---|
| 4 | ; |
---|
| 5 | ; =============================== |
---|
| 6 | ; interp_olr_30n30s_1989_2009.pro |
---|
| 7 | ; =============================== |
---|
| 8 | ; |
---|
[9] | 9 | ; .. graphviz:: |
---|
| 10 | ; |
---|
| 11 | ; digraph interp_olr_30n30s_1989_2009{ |
---|
| 12 | ; graph [ |
---|
| 13 | ; rankdir="LR", |
---|
| 14 | ; ] |
---|
| 15 | ; file_in [shape=ellipse,fontname=Courier,label="/Users/pkb/data/heat_budget/NOAA_OLR/new/olr.day.mean_new.nc"]; |
---|
| 16 | ; |
---|
[50] | 17 | ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; |
---|
[9] | 18 | ; |
---|
| 19 | ; ncfile [shape=ellipse,fontname=Courier,label="/Users/pkb/data/heat_budget/NOAA_OLR/newolr_oafluxgrid_30n30s_19890101_20091231.nc"]; |
---|
| 20 | ; |
---|
| 21 | ; interp_olr_30n30s_1989_2009 [shape=box, |
---|
| 22 | ; fontname=Courier, |
---|
| 23 | ; color=blue, |
---|
| 24 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_olr_30n30s_1989_2009.pro", |
---|
[50] | 25 | ; label="${PROJECT}/src/interp_olr_30n30s_1989_2009.pro"]; |
---|
[9] | 26 | ; |
---|
| 27 | ; {file_in mask} -> {interp_olr_30n30s_1989_2009} -> {ncfile} |
---|
| 28 | ; |
---|
| 29 | ; } |
---|
| 30 | ; |
---|
[6] | 31 | ; SEE ALSO |
---|
| 32 | ; ======== |
---|
| 33 | ; |
---|
[50] | 34 | ; :ref:`project_profile.sh` |
---|
[19] | 35 | ; |
---|
[20] | 36 | ; :func:`report <saxo:report>` |
---|
| 37 | ; :func:`isadirectory <saxo:isadirectory>` |
---|
| 38 | ; :func:`isafile <saxo:isafile>` |
---|
| 39 | ; :func:`initncdf <saxo:initncdf>` |
---|
| 40 | ; :func:`read_ncdf <saxo:read_ncdf>` |
---|
| 41 | ; :func:`domdef <saxo:domdef>` |
---|
| 42 | ; :func:`call_interp2d <saxo:call_interp2d>` |
---|
| 43 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
| 44 | ; |
---|
[6] | 45 | ; EXAMPLES |
---|
| 46 | ; ======== |
---|
| 47 | ; |
---|
| 48 | ; :: |
---|
| 49 | ; |
---|
| 50 | ; IDL> interp_olr_30n30s_1989_2009 |
---|
| 51 | ; |
---|
| 52 | ; TODO |
---|
| 53 | ; ==== |
---|
| 54 | ; |
---|
[50] | 55 | ; hard coded directory - usage of ${PROJECT_ID} |
---|
[6] | 56 | ; |
---|
| 57 | ; coding rules |
---|
| 58 | ; |
---|
[19] | 59 | ; KNOWN ISSUES |
---|
| 60 | ; ============ |
---|
| 61 | ; |
---|
| 62 | ; test of existence of fullfilename_msk not very efficient because |
---|
| 63 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
| 64 | ; |
---|
[6] | 65 | ; EVOLUTIONS |
---|
| 66 | ; ========== |
---|
| 67 | ; |
---|
[19] | 68 | ; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 69 | ; |
---|
| 70 | ; * remove hard coded directory for mask_oaflux_30N30S.nc |
---|
| 71 | ; |
---|
[9] | 72 | ; - fplod 20101215T113118Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 73 | ; |
---|
| 74 | ; * add graph in header |
---|
| 75 | ; |
---|
[6] | 76 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 77 | ; |
---|
| 78 | ; * minimal header |
---|
| 79 | ; |
---|
| 80 | ; - pbk 2008 |
---|
| 81 | ; |
---|
| 82 | ; * creation |
---|
| 83 | ; |
---|
| 84 | ;- |
---|
[5] | 85 | pro interp_olr_30n30s_1989_2009 |
---|
| 86 | @common |
---|
[19] | 87 | ; |
---|
[20] | 88 | ; check for input directory |
---|
[19] | 89 | ; |
---|
[50] | 90 | ; test if ${PROJECT_ID} defined |
---|
| 91 | CASE project_id_env OF |
---|
[19] | 92 | '' : BEGIN |
---|
[50] | 93 | msg = 'eee : ${PROJECT_ID} is not defined' |
---|
[19] | 94 | ras = report(msg) |
---|
| 95 | STOP |
---|
| 96 | END |
---|
| 97 | ELSE: BEGIN |
---|
[50] | 98 | msg = 'iii : ${PROJECT_ID} is ' + project_id_env |
---|
[19] | 99 | ras = report(msg) |
---|
| 100 | END |
---|
| 101 | ENDCASE |
---|
| 102 | ; |
---|
[50] | 103 | iodirin = isadirectory(project_id_env) |
---|
[19] | 104 | ; |
---|
[50] | 105 | ; existence and protection of ${PROJECT_ID} |
---|
[19] | 106 | IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
| 107 | msg = 'eee : the directory' + iodirin + ' is not accessible.' |
---|
| 108 | ras = report(msg) |
---|
| 109 | STOP |
---|
| 110 | ENDIF |
---|
| 111 | ; |
---|
| 112 | ; build mask filename |
---|
| 113 | filename_msk='mask_oaflux_30N30S.nc' |
---|
| 114 | ; |
---|
| 115 | ; check if this file exists |
---|
| 116 | fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST) |
---|
| 117 | IF fullfilename_msk[0] EQ '' THEN BEGIN |
---|
| 118 | msg = 'eee : the file ' + fullfilename_msk + ' was not found.' |
---|
| 119 | ras = report(msg) |
---|
| 120 | STOP |
---|
| 121 | ENDIF |
---|
[5] | 122 | |
---|
| 123 | filein='/Users/pkb/data/heat_budget/NOAA_OLR/new/olr.day.mean_new.nc' |
---|
| 124 | |
---|
| 125 | initncdf, filein |
---|
| 126 | domdef |
---|
| 127 | latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0)) |
---|
| 128 | print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) |
---|
| 129 | print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) |
---|
| 130 | olrin=read_ncdf("olr",19881231, 20091231, file=filein,/nostr) |
---|
| 131 | |
---|
[6] | 132 | mskin=glamt*0.+1. |
---|
| 133 | |
---|
[5] | 134 | timein=time & jptin=jpt |
---|
| 135 | |
---|
[19] | 136 | initncdf, fullfilename_msk |
---|
[5] | 137 | domdef |
---|
| 138 | latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0)) |
---|
| 139 | print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) |
---|
| 140 | print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) |
---|
[19] | 141 | mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) |
---|
[5] | 142 | |
---|
| 143 | help, olrin,lonin,latin,mskin,lonout,latout,mskout |
---|
| 144 | |
---|
| 145 | olrout=fltarr(jpi,jpj,jptin) |
---|
| 146 | |
---|
| 147 | for jt=0,jptin-1 do begin |
---|
| 148 | |
---|
| 149 | print, 'Interpolation jt=',jt,' / ',jptin-1 |
---|
| 150 | tab_olr=reform(olrin(*,*,jt)) |
---|
| 151 | |
---|
| 152 | olrout(*,*,jt)=call_interp2d(tab_olr,lonin,latin,mskin,lonout,latout,method='bilinear') |
---|
| 153 | |
---|
| 154 | olrout(*,*,jt)=olrout(*,*,jt)*mskout+(1.-mskout)*1.e20 |
---|
| 155 | |
---|
| 156 | endfor |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | timein=timein & jptin=jpt |
---|
| 160 | |
---|
| 161 | timein=timein-julday(1,1,1950,00,00) |
---|
| 162 | |
---|
| 163 | lat=latout |
---|
| 164 | lon=lonout |
---|
| 165 | ncfile='!/Users/pkb/data/heat_budget/NOAA_OLR/newolr_oafluxgrid_30n30s_19890101_20091231.nc' |
---|
| 166 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
| 167 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
| 168 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
| 169 | olr_attr={units:'w/m^2',missing_value:1e20,long_name:'Outgoing Longwave Radiation',short_name:'olr',axis:'TYX'} |
---|
| 170 | olra_attr={units:'w/m^2',missing_value:1e20,long_name:'Outgoing Longwave Radiation Anomaly',short_name:'olra',axis:'TYX'} |
---|
| 171 | globattr={source:'NOAA OLR, cf http://www.cdc.noaa.gov/cdc/data.interp_OLR.html, interpolated to 1x1 degree grid and with oaflux mask'} |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | ncfields = 'olr[longitude,latitude,time]=olrout:olr_attr; ' $ |
---|
| 175 | + 'longitude[]=lon:lon_attr; ' $ |
---|
| 176 | + 'latitude[]=lat:lat_attr; ' $ |
---|
| 177 | + 'time[*time]=timein:time_attr ' $ |
---|
| 178 | + ' @ globattr' |
---|
| 179 | |
---|
| 180 | @ncdf_quickwrite |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | end |
---|