[6] | 1 | ;+ |
---|
| 2 | ; |
---|
[74] | 3 | ; .. _TropFlux_NRT_ncdf.pro: |
---|
[6] | 4 | ; |
---|
[74] | 5 | ; ===================== |
---|
| 6 | ; TropFlux_NRT_ncdf.pro |
---|
| 7 | ; ===================== |
---|
[6] | 8 | ; |
---|
[88] | 9 | ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc` |
---|
| 10 | ; containing |
---|
| 11 | ; ws corrected on OAFLUX grid |
---|
| 12 | ; has been produced by |
---|
[174] | 13 | ; :func:`tropflux_swr_blnd`. |
---|
[88] | 14 | ; |
---|
| 15 | ; :file:`${PROJECT_OD}/TropFlux_lwr_19890101_20091231.nc` |
---|
| 16 | ; containing |
---|
| 17 | ; lwr corrected on OAFLUX grid |
---|
| 18 | ; has been produced by |
---|
| 19 | ; :ref:`lwr_correction_ncdf.pro`. |
---|
| 20 | ; |
---|
| 21 | ; :file:`${PROJECT_OD}/TropFlux_19890101_20091231_coare3.nc` |
---|
| 22 | ; containing |
---|
| 23 | ; ++ |
---|
| 24 | ; has been produced by |
---|
| 25 | ; :ref:`TropFlux_19890101_20091231.pro`. |
---|
| 26 | ; |
---|
| 27 | ; ++ are written |
---|
| 28 | ; in :file:`${PROJECT_OD}/TropFlux_19890101_20091231.nc` |
---|
| 29 | ; if this file not already exists. |
---|
| 30 | ; |
---|
[7] | 31 | ; .. graphviz:: |
---|
| 32 | ; |
---|
[74] | 33 | ; digraph tropflux_nrt_ncdf { |
---|
| 34 | ; |
---|
[88] | 35 | ; file_swr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc"]; |
---|
| 36 | ; file_lwr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_19890101_200912310.nc"]; |
---|
| 37 | ; file_coare [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_19890101_20091231_coarev3.nc"]; |
---|
| 38 | ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_19890101_20091231.nc"]; |
---|
| 39 | ; |
---|
[74] | 40 | ; tropflux_nrt_ncdf [shape=box, |
---|
[7] | 41 | ; fontname=Courier, |
---|
| 42 | ; color=blue, |
---|
[74] | 43 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_NRT_ncdf.pro", |
---|
| 44 | ; label="${PROJECT}/src/TropFlux_NRT_ncdf.pro" ]; |
---|
| 45 | ; |
---|
[88] | 46 | ; {file_swr file_lwr file_coare} -> {tropflux_nrt_ncdf} -> {file_out} |
---|
[7] | 47 | ; |
---|
[88] | 48 | ; } |
---|
| 49 | ; |
---|
[6] | 50 | ; SEE ALSO |
---|
| 51 | ; ======== |
---|
| 52 | ; |
---|
[20] | 53 | ; :func:`initncdf <saxo:initncdf>` |
---|
| 54 | ; :func:`read_ncdf <saxo:read_ncdf>` |
---|
| 55 | ; :func:`julday <saxo:julday>` |
---|
| 56 | ; :func:`jul2date <saxo:jul2date>` |
---|
| 57 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
[97] | 58 | ; |
---|
[6] | 59 | ; EXAMPLES |
---|
| 60 | ; ======== |
---|
| 61 | ; |
---|
| 62 | ; :: |
---|
| 63 | ; |
---|
[90] | 64 | ; IDL> .compile TropFlux_NRT_ncdf |
---|
[74] | 65 | ; IDL> tropflux_nrt_ncdf |
---|
[6] | 66 | ; |
---|
| 67 | ; TODO |
---|
| 68 | ; ==== |
---|
| 69 | ; |
---|
| 70 | ; coding rules |
---|
| 71 | ; |
---|
[90] | 72 | ; get rid of uppercase to avoid compile |
---|
| 73 | ; |
---|
[78] | 74 | ; create 4 files instead of one now |
---|
| 75 | ; |
---|
[6] | 76 | ; EVOLUTIONS |
---|
| 77 | ; ========== |
---|
| 78 | ; |
---|
[90] | 79 | ; $Id: TropFlux_NRT_ncdf.pro 88 2011-08-19 15:40:14Z pinsard $ |
---|
[97] | 80 | ; |
---|
[81] | 81 | ; $URL$ |
---|
| 82 | ; |
---|
[74] | 83 | ; - fplod 20110809T133815Z cratos (Linux) |
---|
| 84 | ; |
---|
| 85 | ; * remove v50 from pro name and in the graph |
---|
[88] | 86 | ; * add coarev3 to the file coming from TropFlux_19890101_20091231.pro |
---|
| 87 | ; * use $PROJECT_OD |
---|
[74] | 88 | ; |
---|
[7] | 89 | ; - fplod 20101214T112526Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 90 | ; |
---|
| 91 | ; * add graph |
---|
[74] | 92 | ; |
---|
[6] | 93 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 94 | ; |
---|
| 95 | ; * minimal header |
---|
| 96 | ; |
---|
| 97 | ; - pbk 2008 |
---|
| 98 | ; |
---|
| 99 | ; * creation |
---|
| 100 | ; |
---|
| 101 | ;- |
---|
[74] | 102 | pro TropFlux_NRT_ncdf |
---|
[88] | 103 | ; |
---|
| 104 | @cm_4cal |
---|
| 105 | @cm_4data |
---|
| 106 | @cm_4mesh |
---|
| 107 | @cm_4data |
---|
| 108 | @cm_project |
---|
| 109 | ; |
---|
| 110 | ; test if ${PROJECT_OD} defined |
---|
| 111 | CASE project_od_env OF |
---|
| 112 | '' : BEGIN |
---|
| 113 | msg = 'eee : ${PROJECT_OD} is not defined' |
---|
| 114 | ras = report(msg) |
---|
| 115 | STOP |
---|
| 116 | END |
---|
| 117 | ELSE: BEGIN |
---|
| 118 | msg = 'iii : ${PROJECT_OD} is ' + project_od_env |
---|
| 119 | ras = report(msg) |
---|
| 120 | END |
---|
| 121 | ENDCASE |
---|
| 122 | ; |
---|
| 123 | ; check if output data will be possible |
---|
| 124 | iodirout = isadirectory(project_od_env) |
---|
| 125 | ; |
---|
| 126 | ; existence and protection for reading |
---|
| 127 | IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
| 128 | msg = 'eee : the directory' + iodirout + ' is not accessible.' |
---|
| 129 | ras = report(msg) |
---|
| 130 | STOP |
---|
| 131 | ENDIF |
---|
| 132 | ; |
---|
| 133 | ; existence and protection for writing |
---|
| 134 | IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN |
---|
| 135 | msg = 'eee : the directory' + iodirout + ' was not found.' |
---|
| 136 | ras = report(msg) |
---|
| 137 | STOP |
---|
| 138 | ENDIF |
---|
| 139 | ; |
---|
| 140 | ; build SWR blnd data filename |
---|
| 141 | filename_swr_blnd="TropFlux_swr_19890101_20091231_BLND.nc" |
---|
| 142 | ; |
---|
| 143 | ; check if this file exists |
---|
| 144 | msg='iii : looking for ' + filename_swr_blnd |
---|
| 145 | ras = report(msg) |
---|
| 146 | fullfilename_swr_blnd = isafile(iodirout + filename_swr_blnd, NEW=0, /MUST_EXIST) |
---|
| 147 | IF fullfilename_swr_blnd[0] EQ '' THEN BEGIN |
---|
| 148 | msg = 'eee : the file ' + fullfilename_swr_blnd + ' was not found.' |
---|
| 149 | ras = report(msg) |
---|
| 150 | STOP |
---|
| 151 | ENDIF |
---|
| 152 | ; |
---|
| 153 | ; build LWR data filename |
---|
| 154 | filename_lwr="TropFlux_lwr_19890101_20091231.nc" |
---|
| 155 | ; |
---|
| 156 | ; check if this file exists |
---|
| 157 | msg='iii : looking for ' + filename_lwr |
---|
| 158 | ras = report(msg) |
---|
| 159 | fullfilename_lwr = isafile(iodirout + filename_lwr, NEW=0, /MUST_EXIST) |
---|
| 160 | IF fullfilename_lwr[0] EQ '' THEN BEGIN |
---|
| 161 | msg = 'eee : the file ' + fullfilename_lwr + ' was not found.' |
---|
| 162 | ras = report(msg) |
---|
| 163 | STOP |
---|
| 164 | ENDIF |
---|
| 165 | ; |
---|
| 166 | ; build COARE data filename |
---|
| 167 | filename_coare="TropFlux_19890101_20091231_coarev3.nc" |
---|
| 168 | ; |
---|
| 169 | ; check if this file exists |
---|
| 170 | msg='iii : looking for ' + filename_lwr |
---|
| 171 | ras = report(msg) |
---|
| 172 | fullfilename_coare = isafile(iodirout + filename_coare, NEW=0, /MUST_EXIST) |
---|
| 173 | IF fullfilename_coare[0] EQ '' THEN BEGIN |
---|
| 174 | msg = 'eee : the file ' + fullfilename_coare + ' was not found.' |
---|
| 175 | ras = report(msg) |
---|
| 176 | STOP |
---|
| 177 | ENDIF |
---|
| 178 | ; |
---|
| 179 | filename_out='TropFlux_19890101_20091231.nc' |
---|
| 180 | fullfilename_out = iodirout + filename_out |
---|
| 181 | ; in order to avoid unexpected overwritten |
---|
| 182 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
| 183 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
| 184 | ras = report(msg) |
---|
| 185 | STOP |
---|
| 186 | ENDIF |
---|
| 187 | ; |
---|
[97] | 188 | st=19800101 |
---|
[94] | 189 | en=20101231 |
---|
[97] | 190 | ; |
---|
[88] | 191 | initncdf, fullfilename_swr_blnd |
---|
[97] | 192 | ; |
---|
[88] | 193 | swr=read_ncdf("swr", st, en, file=fullfilename_swr_blnd,/nostr) |
---|
[97] | 194 | ; |
---|
[88] | 195 | initncdf, fullfilename_lwr |
---|
| 196 | lwr=read_ncdf("lwr", st, en, file=fullfilename_lwr,/nostr) |
---|
[97] | 197 | ; |
---|
[88] | 198 | initncdf, fullfilename_coare |
---|
| 199 | lhf=read_ncdf("lhf", st, en, file=fullfilename_coare,/nostr) |
---|
| 200 | shf=read_ncdf("shf", st, en, file=fullfilename_coare,/nostr) |
---|
[97] | 201 | ; |
---|
[5] | 202 | help, swr, lwr, lhf, shf |
---|
[97] | 203 | ; |
---|
[100] | 204 | time=timegen(7670, start=julday(1,1,1989,0), units='days') |
---|
[94] | 205 | jpt=n_elements(time) |
---|
[97] | 206 | ; |
---|
[5] | 207 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
| 208 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
[97] | 209 | ; |
---|
[5] | 210 | time=time-julday(1,1,1950,00,00) |
---|
[7] | 211 | ; |
---|
[5] | 212 | lat=reform(gphit(0,0:jpj-1)) |
---|
| 213 | lon=reform(glamt(0:jpi-1,0)) |
---|
[97] | 214 | ; |
---|
[90] | 215 | ncfile='!' + fullfilename_out |
---|
[5] | 216 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
| 217 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
| 218 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'} |
---|
[100] | 219 | globattr={Source:'TropFlux - Air-Sea Fluxes for the Global Tropics', Resolution:'1 x 1 degree and daily', IDL_program_name:'TropFlux_ncdf.pro',Timerange:cda0+' - '+cda1, More_Info:'ISCCP based SWR until 2007 and OLR based SWR after that with a 90 day linear transition between the two'} |
---|
[5] | 220 | sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'} |
---|
| 221 | lw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Longwave Radiation',short_name:'lwr',axis:'TYX'} |
---|
| 222 | sh_attr={units:'w/m^2',missing_value:1.e20,long_name:'Sensible Heat Flux',short_name:'shf',axis:'TYX'} |
---|
| 223 | lh_attr={units:'w/m^2',missing_value:1.e20,long_name:'Latent Heat Flux',short_name:'lhf',axis:'TYX'} |
---|
[97] | 224 | ; |
---|
[5] | 225 | ncfields = 'swr[longitude,latitude,time]=swr:sw_attr; ' $ |
---|
| 226 | +'lwr[longitude,latitude,time]=lwr:lw_attr; ' $ |
---|
| 227 | +'lhf[longitude,latitude,time]=lhf:lh_attr; ' $ |
---|
| 228 | +'shf[longitude,latitude,time]=shf:sh_attr; ' $ |
---|
| 229 | + 'longitude[]=lon:lon_attr; ' $ |
---|
| 230 | + 'latitude[]=lat:lat_attr; ' $ |
---|
| 231 | + 'time[*time]=time:time_attr ' $ |
---|
| 232 | + ' @ globattr' |
---|
[97] | 233 | ; |
---|
[5] | 234 | @ncdf_quickwrite |
---|
[97] | 235 | ; |
---|
[5] | 236 | end |
---|