Changeset 175 for trunk/src/lwr_correction_ncdf.pro
- Timestamp:
- 03/22/12 14:40:17 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lwr_correction_ncdf.pro
r167 r175 1 1 ;+ 2 ;3 ; .. _lwr_correction_ncdf.pro:4 2 ; 5 3 ; ======================= … … 7 5 ; ======================= 8 6 ; 7 ; .. function:: lwr_correction_ncdf(yyyymmddb,yyyymmdde) 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 9 12 ; Correction of lwr on OAFLUX grid 10 13 ; 11 ; :file:`${PROJECT_OD}/erai_lwr_ 19890101_20091231_oafluxgrid.nc`14 ; :file:`${PROJECT_OD}/erai_lwr_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 12 15 ; containing 13 16 ; ++ … … 17 20 ; Corrected lwr on OAFLUX grid 18 21 ; is written in 19 ; :file:`${PROJECT_OD}/TropFlux_lwr_ 19890101_20091231.nc`22 ; :file:`${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc` 20 23 ; if this file not already exists. 21 24 ; 22 25 ; This output file 23 ; :file:`${PROJECT_OD}/TropFlux_lwr_ 19890101_20091231.nc`26 ; :file:`${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc` 24 27 ; will be used by 25 ; : ref:`TropFlux_19890101_20091231.pro`.28 ; :func:`tropflux`. 26 29 ; 27 30 ; .. only:: man … … 35 38 ; digraph lwr_correction_ncdf { 36 39 ; 37 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_lwr_ 19890101_20091231_oafluxgrid.nc"];38 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_ 19890101_20091231.nc"];40 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_lwr_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 41 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc"]; 39 42 ; 40 43 ; lwr_correction_ncdf [shape=box, … … 51 54 ; ======== 52 55 ; 56 ; :ref:`mooring_corrections` 57 ; 58 ; Used by :ref:`tropflux.sh` 59 ; 53 60 ; :ref:`project_profile.sh` 54 ;55 ; :ref:`mooring_corrections`56 61 ; 57 62 ; :func:`interp_erai_lwr` and :ref:`add_19890101.sh` … … 69 74 ; :: 70 75 ; 71 ; IDL> lwr_correction_ncdf 76 ; IDL> yyyymmddb = 20000101L 77 ; IDL> yyyymmdde = 20001231L 78 ; IDL> result = lwr_correction_ncdf(yyyymmddb, yyyymmdde) 79 ; IDL> print, result 72 80 ; 73 81 ; TODO … … 94 102 ; 95 103 ; $URL$ 104 ; 105 ; - fplod 20120322 106 ; 107 ; * taking project_overwite into account 108 ; * try to add compile_opt seems to be incompatible with ncdf_quickwrite 109 ; * pro -> function 110 ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters 111 ; * get rid of timegen 96 112 ; 97 113 ; - fplod 20110819T105050Z aedon.locean-ipsl.upmc.fr (Darwin) … … 121 137 ; 122 138 ;- 123 pro lwr_correction_ncdf 139 function lwr_correction_ncdf $ 140 , yyyymmddb $ 141 , yyyymmdde 142 ; 143 ;++compile_opt idl2, strictarrsubs, logical_predicate 124 144 ; 125 145 @cm_4cal … … 129 149 @cm_project 130 150 ; 151 ; Return to caller if errors 152 ON_ERROR, 2 153 ; 154 result = -1 155 ; 156 usage = 'result = lwr_correction_ncdf(yyyymmddb, yyyymmdde)' 157 nparam = N_PARAMS() 158 IF (nparam NE 2) THEN BEGIN 159 ras = report(['Incorrect number of arguments.' $ 160 + '!C' $ 161 + 'Usage : ' + usage]) 162 return, result 163 ENDIF 164 ; 131 165 ; test if ${PROJECT_OD} defined 132 166 CASE project_od_env OF … … 134 168 msg = 'eee : ${PROJECT_OD} is not defined' 135 169 ras = report(msg) 136 STOP170 return, result 137 171 END 138 172 ELSE: BEGIN … … 149 183 msg = 'eee : the directory' + iodirout + ' is not accessible.' 150 184 ras = report(msg) 151 STOP185 return, result 152 186 ENDIF 153 187 ; … … 156 190 msg = 'eee : the directory' + iodirout + ' was not found.' 157 191 ras = report(msg) 158 STOP 159 ENDIF 160 ; 161 da1=19880101 162 da2=20091231 192 return, result 193 ENDIF 163 194 ; 164 195 ; build data filename 165 filename='erai_lwr_ 19890101_20091231_oafluxgrid.nc'196 filename='erai_lwr_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 166 197 ; 167 198 ; check if this file exists … … 172 203 msg = 'eee : the file ' + fullfilename + ' was not found.' 173 204 ras = report(msg) 174 STOP205 return, result 175 206 ENDIF 176 207 ; 177 208 ; build output filename 178 filename_out = 'TropFlux_lwr_ 19890101_20091231.nc'209 filename_out = 'TropFlux_lwr_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 179 210 fullfilename_out = iodirout + filename_out 180 211 ; in order to avoid unexpected overwritten 181 IF ( FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN212 IF ((FILE_TEST(fullfilename_out) EQ 1) AND (project_overwrite EQ 0)) THEN BEGIN 182 213 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 183 214 ras = report(msg) 184 STOP215 return, result 185 216 ENDIF 186 217 ; 187 218 initncdf, fullfilename 188 lwr=read_ncdf('lwr',da1,da2,file=fullfilename,/nostr) 219 lwr=read_ncdf('lwr',yyyymmddb-.5d,yyyymmdde,file=fullfilename,/nostr) 220 timein=24.d*(time-julday(1,1,1957,0,0,0)) 221 jpt=n_elements(timein) 222 da=jul2date(time[0]) 223 cda0=string(da,format='(i8.8)') 224 da=jul2date(time[jpt-1]) 225 cda1=string(da,format='(i8.8)') 226 print, 'lwr in lwr_correction_ncdf first date ', cda0 227 print, 'lwr in lwr_correction_ncdf last date ' , cda1 228 ; 189 229 help, lwr 190 230 ; … … 197 237 ; 198 238 for jt=0,jpt-1 do begin 199 jtt=(time (jt)-julday(1,1,yea(jt))) < 364200 t=reform(lwr_mean (*,*))201 lwr_m (*,*,jt)=t239 jtt=(time[jt]-julday(1,1,yea[jt])) < 364 240 t=reform(lwr_mean[*,*]) 241 lwr_m[*,*,jt]=t 202 242 endfor 203 243 help, lwr_m … … 219 259 ; 220 260 ;writing field 221 lat=reform(gphit(0,0:jpj-1)) 222 lon=reform(glamt(0:jpi-1,0)) 223 time=timegen(7670, start=julday(1,1,1989,0), units='days') 224 jpt=n_elements(time) 225 ; 226 cda0=string(jul2date(time(0)),format='(i8.8)') 227 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 228 ; 229 time=time-julday(1,1,1950) 230 jpt=n_elements(time) 261 lat=reform(gphit[0,0:jpj-1]) 262 lon=reform(glamt[0:jpi-1,0]) 231 263 ; 232 264 ncfile='!' + fullfilename_out … … 237 269 lwr_attr={units:'degK',missing_value:1.e20,long_name:'Air Temperature at 2m',short_name:'lwr',axis:'TYX'} 238 270 ; 239 ncfields = 'lwr[longitude,latitude, time]=lwr_new:lwr_attr; ' $271 ncfields = 'lwr[longitude,latitude,*time]=lwr_new:lwr_attr; ' $ 240 272 + 'longitude[]=lon:lon_attr; ' $ 241 273 + 'latitude[]=lat:lat_attr; ' $ 242 + 'time[ *time]=time:time_attr ' $274 + 'time[]=timein:time_attr ' $ 243 275 + ' @ globattr' 244 276 ; 245 277 @ncdf_quickwrite 246 278 ; 279 result = 0 280 return, result 281 ; 247 282 end
Note: See TracChangeset
for help on using the changeset viewer.