[6] | 1 | ;+ |
---|
| 2 | ; |
---|
[19] | 3 | ; .. _interp_erai_lwr_1989_2009.pro: |
---|
[6] | 4 | ; |
---|
| 5 | ; ============================= |
---|
| 6 | ; interp_erai_lwr_1989_2009.pro |
---|
| 7 | ; ============================= |
---|
| 8 | ; |
---|
[8] | 9 | ; .. graphviz:: |
---|
| 10 | ; |
---|
| 11 | ; digraph interp_erai_lwr_1989_2009 { |
---|
| 12 | ; graph [ |
---|
| 13 | ; rankdir="LR", |
---|
| 14 | ; ] |
---|
[19] | 15 | ; mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/mask_oaflux_30N30S.nc"]; |
---|
[8] | 16 | ; |
---|
| 17 | ; file_in [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/ERAI_global/20c3m_erai_str_TROP_1989_2009.nc"]; |
---|
| 18 | ; |
---|
| 19 | ; ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc"]; |
---|
| 20 | ; |
---|
| 21 | ; interp_erai_lwr_1989_2009 [shape=box, |
---|
| 22 | ; fontname=Courier, |
---|
| 23 | ; color=blue, |
---|
| 24 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_lwr_1989_2009.pro", |
---|
| 25 | ; label="${TROPFLUX}/src/interp_erai_lwr_1989_2009.pro"]; |
---|
| 26 | ; |
---|
| 27 | ; {mask file_in} -> {interp_erai_lwr_1989_2009} -> {ncfile} |
---|
| 28 | ; |
---|
| 29 | ; } |
---|
| 30 | ; |
---|
[6] | 31 | ; SEE ALSO |
---|
| 32 | ; ======== |
---|
| 33 | ; |
---|
[19] | 34 | ; :ref:`tropflux_profile.sh` |
---|
| 35 | ; |
---|
[6] | 36 | ; EXAMPLES |
---|
| 37 | ; ======== |
---|
| 38 | ; |
---|
| 39 | ; :: |
---|
| 40 | ; |
---|
| 41 | ; IDL> interp_erai_lwr_1989_2009 |
---|
| 42 | ; |
---|
| 43 | ; TODO |
---|
| 44 | ; ==== |
---|
| 45 | ; |
---|
| 46 | ; hard coded directory - usage of ${TROPFLUX_ID} |
---|
| 47 | ; |
---|
| 48 | ; coding rules |
---|
| 49 | ; |
---|
[19] | 50 | ; KNOWN ISSUES |
---|
| 51 | ; ============ |
---|
| 52 | ; |
---|
| 53 | ; test of existence of fullfilename_msk not very efficient because |
---|
| 54 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
| 55 | ; |
---|
[6] | 56 | ; EVOLUTIONS |
---|
| 57 | ; ========== |
---|
| 58 | ; |
---|
[19] | 59 | ; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 60 | ; |
---|
| 61 | ; * remove hard coded directory for mask_oaflux_30N30S.nc |
---|
| 62 | ; |
---|
[8] | 63 | ; - fplod 20101215T094137Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 64 | ; |
---|
| 65 | ; * add graph in header |
---|
| 66 | ; |
---|
[6] | 67 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 68 | ; |
---|
| 69 | ; * minimal header |
---|
| 70 | ; |
---|
| 71 | ; - pbk 2008 |
---|
| 72 | ; |
---|
| 73 | ; * creation |
---|
| 74 | ; |
---|
| 75 | ;- |
---|
[5] | 76 | pro interp_erai_lwr_1989_2009 |
---|
| 77 | @common |
---|
[19] | 78 | ; |
---|
| 79 | ; check for input directory |
---|
| 80 | ; |
---|
| 81 | ; test if ${TROPFLUX_ID} defined |
---|
| 82 | tropflux_id_env=GETENV('TROPFLUX_ID') |
---|
| 83 | CASE tropflux_id_env OF |
---|
| 84 | '' : BEGIN |
---|
| 85 | msg = 'eee : ${TROPFLUX_ID} is not defined' |
---|
| 86 | ras = report(msg) |
---|
| 87 | STOP |
---|
| 88 | END |
---|
| 89 | ELSE: BEGIN |
---|
| 90 | msg = 'iii : ${TROPFLUX_ID} is ' + tropflux_id_env |
---|
| 91 | ras = report(msg) |
---|
| 92 | END |
---|
| 93 | ENDCASE |
---|
| 94 | ; |
---|
| 95 | iodirin = isadirectory(tropflux_id_env) |
---|
| 96 | ; |
---|
| 97 | ; existence and protection of ${TROPFLUX_ID} |
---|
| 98 | IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
| 99 | msg = 'eee : the directory' + iodirin + ' is not accessible.' |
---|
| 100 | ras = report(msg) |
---|
| 101 | STOP |
---|
| 102 | ENDIF |
---|
| 103 | ; |
---|
| 104 | ; build mask filename |
---|
| 105 | filename_msk='mask_oaflux_30N30S.nc' |
---|
| 106 | ; |
---|
| 107 | ; check if this file exists |
---|
| 108 | fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST) |
---|
| 109 | IF fullfilename_msk[0] EQ '' THEN BEGIN |
---|
| 110 | msg = 'eee : the file ' + fullfilename_msk + ' was not found.' |
---|
| 111 | ras = report(msg) |
---|
| 112 | STOP |
---|
| 113 | ENDIF |
---|
[5] | 114 | |
---|
| 115 | st=19890101 & en=20090801 |
---|
| 116 | |
---|
| 117 | filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_str_TROP_1989_2009.nc' |
---|
| 118 | initncdf, filein |
---|
| 119 | lwrin=read_ncdf("str",0,7668,/timestep,file=filein,/nostr) |
---|
| 120 | lwrin=-1*lwrin |
---|
| 121 | help, lwrin |
---|
| 122 | |
---|
| 123 | initncdf, filein |
---|
| 124 | domdef |
---|
| 125 | latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0)) |
---|
| 126 | print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) |
---|
| 127 | print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) |
---|
| 128 | |
---|
| 129 | timein=time & jptin=jpt |
---|
| 130 | tab=lwrin(*,*,0) |
---|
| 131 | mskin=glamt*0.+1. |
---|
| 132 | |
---|
[19] | 133 | initncdf, fullfilename_msk |
---|
[5] | 134 | domdef |
---|
| 135 | latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0)) |
---|
| 136 | print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) |
---|
| 137 | print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) |
---|
[19] | 138 | mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) |
---|
[5] | 139 | |
---|
| 140 | help, lwrin |
---|
| 141 | |
---|
| 142 | si=size(swrin) |
---|
| 143 | lwrout=fltarr(jpi,jpj,jptin) |
---|
| 144 | |
---|
| 145 | for jt=0,jptin-1 do begin |
---|
| 146 | print, 'Interpolation jt=',jt,' / ',jptin-1 |
---|
| 147 | |
---|
| 148 | tab=reform(lwrin(*,*,jt)) |
---|
| 149 | lwrout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear') |
---|
| 150 | lwrout(*,*,jt)=lwrout(*,*,jt)*mskout+(1.-mskout)*1.e20 |
---|
| 151 | |
---|
| 152 | endfor |
---|
| 153 | |
---|
| 154 | time=timegen(7669, start=julday(1,2,1989,0), units='days') & jpt=n_elements(time) |
---|
| 155 | tt=time & jptin=jpt |
---|
| 156 | cda0=string(jul2date(tt(0)),format='(i8.8)') |
---|
| 157 | cda1=string(jul2date(tt(jpt-1)),format='(i8.8)') |
---|
| 158 | tt=tt-julday(1,1,1950,00,00,00) |
---|
| 159 | xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*)) |
---|
| 160 | |
---|
[19] | 161 | initncdf, fullfilename_msk |
---|
[5] | 162 | valmask=1.e20 |
---|
| 163 | |
---|
| 164 | ylat=latout |
---|
| 165 | xlon=lonout |
---|
| 166 | ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc' |
---|
| 167 | |
---|
| 168 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
| 169 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
| 170 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
| 171 | |
---|
| 172 | lwr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation ',short_name:'lwr',axis:'TYX'} |
---|
| 173 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
| 174 | globattr={source:'Tropical ocean fluxes obtained from ERA Interim',timerange:cda0+' - '+cda1} |
---|
| 175 | |
---|
| 176 | help,lwrout |
---|
| 177 | |
---|
| 178 | ncfields = 'lwr[longitude,latitude,time]=lwrout:lwr_attr; ' $ |
---|
| 179 | + 'longitude[]=xlon:lon_attr; ' $ |
---|
| 180 | + 'latitude[]=ylat:lat_attr; ' $ |
---|
| 181 | + 'tt[*time]=tt:time_attr ' $ |
---|
| 182 | + ' @ globattr' |
---|
| 183 | |
---|
| 184 | @ncdf_quickwrite |
---|
| 185 | |
---|
| 186 | return |
---|
| 187 | end |
---|