Changeset 175
- Timestamp:
- 03/22/12 14:40:17 (12 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/docs_dev/source/guides/data_content.rst
r172 r175 133 133 - :func:`oaflux_mask_30n30s` 134 134 135 - : ref:`TropFlux_19890101_20091231.pro`135 - :func:`tropflux` 136 136 137 137 - :func:`interp_erai_dewt` -
trunk/docs/docs_dev/source/guides/generate_tropflux.rst
r174 r175 131 131 tools : 132 132 - :func:`tropflux_swr_dt`, :func:`tropflux_swr_nrt`, :func:`tropflux_swr_blnd` 133 - : ref:`lwr_correction_ncdf.pro`134 - : ref:`q2m_correction_ncdf.pro`135 - : ref:`sst_correction_ncdf.pro`136 - : ref:`t2m_correction_ncdf.pro`137 - : ref:`ws_correction_ncdf.pro`133 - :func:`lwr_correction_ncdf` 134 - :func:`q2m_correction_ncdf` 135 - :func:`sst_correction_ncdf` 136 - :func:`t2m_correction_ncdf` 137 - :func:`ws_correction_ncdf` 138 138 139 139 Result after that, 7 netcdf files for: NOAA OLR, ERA-I :math:`T_a`, ERA-I :math:`q_a`, ERA-I wind speed, ERA-I SST, ISCCP net SW, ERA-I net LW. … … 148 148 tools : 149 149 - :func:`cronin_gustiness_ncdf` 150 - : ref:`TropFlux_19890101_20091231.pro` (:func:`cor30a`), :ref:`TropFlux_NRT_ncdf.pro`150 - :func:`tropflux` (:func:`cor30a`), :ref:`TropFlux_NRT_ncdf.pro` 151 151 152 152 After that step, there are 5 files: Tropflux :math:`T_{2m}`, :math:`q_{2m}`, SST, wind, and one file with the 4 components of the net flux (sensible, latent, SWR, LWR) -
trunk/src/TropFlux_NRT_ncdf.pro
r174 r175 17 17 ; lwr corrected on OAFLUX grid 18 18 ; has been produced by 19 ; : ref:`lwr_correction_ncdf.pro`.19 ; :func:`lwr_correction_ncdf`. 20 20 ; 21 21 ; :file:`${PROJECT_OD}/TropFlux_19890101_20091231_coare3.nc` … … 23 23 ; ++ 24 24 ; has been produced by 25 ; : ref:`TropFlux_19890101_20091231.pro`.25 ; :func:`tropflux`. 26 26 ; 27 27 ; ++ are written -
trunk/src/cor30a.pro
r97 r175 69 69 ; ======== 70 70 ; 71 ; used by : ref:`TropFlux_19890101_20091231.pro`71 ; used by :func:`tropflux` 72 72 ; 73 73 ; call :func:`psiu`, :func:`psit`. -
trunk/src/cronin_gustiness_ncdf.pro
r174 r175 13 13 ; 14 14 ; :file:`${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc` have been produced by 15 ; : ref:`sst_correction_ncdf.pro`.15 ; :func:`sst_correction_ncdf`. 16 16 ; 17 17 ; Cronin gustiness corrected ++ on corrected sst on OAFLUX grid … … 23 23 ; :func:`tropflux_swr_blnd` 24 24 ; and 25 ; : ref:`TropFlux_19890101_20091231.pro`.25 ; :func:`tropflux`. 26 26 ; 27 27 ; .. graphviz:: … … 58 58 ; :ref:`mooring_corrections` 59 59 ; 60 ; : ref:`sst_correction_ncdf.pro`.60 ; :func:`sst_correction_ncdf`. 61 61 ; 62 62 ; :func:`initncdf <saxo:initncdf>` -
trunk/src/d2m_to_q2m_erai.pro
r174 r175 39 39 ; :file:`${PROJECT_OD}/erai_q2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 40 40 ; will be used by 41 ; : ref:`q2m_correction_ncdf.pro`.41 ; :func:`q2m_correction_ncdf`. 42 42 ; 43 43 ; .. only:: man … … 83 83 ; :func:`interp_erai_t2m` 84 84 ; 85 ; : ref:`q2m_correction_ncdf.pro`85 ; :func:`q2m_correction_ncdf` 86 86 ; 87 87 ; :func:`rh_to_spechum` -
trunk/src/interp_erai_lwr.pro
r174 r175 91 91 ; 92 92 ; lwr first date 19991231 vs yyyymmddb = 20000101L 93 ; 93 ; 94 94 ; make it work : pb on loholt1 idl8: 95 95 ; … … 154 154 ; - fplod 20110819T084310Z aedon.locean-ipsl.upmc.fr (Darwin) 155 155 ; 156 ; * replace next step :ref:`lwr_correction_ncdf.pro`by :ref:`add_19890101.sh`156 ; * replace next step lwr_correction_ncdf.pro by :ref:`add_19890101.sh` 157 157 ; * fix output file name to erai_lwr_19890102_20091231_oafluxgrid.nc 158 158 ; -
trunk/src/interp_erai_sst.pro
r174 r175 32 32 ; :file:`${PROJECT_OD}/erai_sst_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 33 33 ; must be processed after by 34 ; : ref:`sst_correction_ncdf.pro`.34 ; :func:`sst_correction_ncdf`. 35 35 ; 36 36 ; .. only:: man … … 76 76 ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` 77 77 ; 78 ; : ref:`sst_correction_ncdf.pro`78 ; :func:`sst_correction_ncdf` 79 79 ; 80 80 ; EXAMPLES -
trunk/src/interp_erai_t2m.pro
r174 r175 31 31 ; :file:`${PROJECT_OD}/erai_t2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 32 32 ; must be processed after by 33 ; : ref:`t2m_correction_ncdf.pro`.33 ; :func:`t2m_correction_ncdf`. 34 34 ; 35 35 ; .. only:: man … … 81 81 ; :func:`ncdf_getatt <saxo:ncdf_getatt>` 82 82 ; 83 ; : ref:`t2m_correction_ncdf.pro`83 ; :func:`t2m_correction_ncdf` 84 84 ; 85 85 ; EXAMPLES … … 380 380 t2min=read_ncdf('t2',yyyymmddb-.5d,yyyymmdde,file=fullfilename_t2,/nost) 381 381 ;; time:units = "hours since 1957-01-01 00:00:0.0" ; 382 timein=24.d*(time-julday(1,1,1957,0,0,0)) 382 timein=24.d*(time-julday(1,1,1957,0,0,0)) 383 383 jptin=n_elements(timein) 384 384 da=jul2date(time[0]) 385 385 cda0=string(da,format='(i8.8)') 386 da=jul2date(time[jpt-1]) 386 da=jul2date(time[jpt-1]) 387 387 cda1=string(da,format='(i8.8)') 388 388 print, 't2m first date ', cda0 -
trunk/src/interp_erai_ws.pro
r172 r175 37 37 ; :file:`${PROJECT_OD}/erai_ws_19890101_20091231_oafluxgrid.nc` 38 38 ; must be processed after by 39 ; : ref:`ws_correction_ncdf.pro`.39 ; :func:`ws_correction_ncdf`. 40 40 ; 41 41 ; .. only:: man … … 82 82 ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` 83 83 ; 84 ; : ref:`ws_correction_ncdf.pro`84 ; :func:`ws_correction_ncdf` 85 85 ; 86 86 ; EXAMPLES … … 306 306 u10in=read_ncdf("u10", yyyymmddb - .5d, yyyymmdde, file=fullfilename,/nostr) 307 307 ; 308 timein=24.d*(time-julday(1,1,1957,0,0,0)) 308 timein=24.d*(time-julday(1,1,1957,0,0,0)) 309 309 jpt=n_elements(timein) 310 310 da=jul2date(time[0]) 311 311 cda0=string(da,format='(i8.8)') 312 da=jul2date(time[jpt-1]) 312 da=jul2date(time[jpt-1]) 313 313 cda1=string(da,format='(i8.8)') 314 314 print, 'u10 first date ', cda0 -
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 -
trunk/src/oaflux_mask_30n30s.pro
r172 r175 62 62 ; 63 63 ; Following program use :func:`oaflux_mask_30n30s` output: 64 ; : ref:`TropFlux_19890101_20091231.pro`,64 ; :func:`tropflux`, 65 65 ; :func:`interp_erai_dewt`, 66 66 ; :func:`interp_erai_lwr`, -
trunk/src/paper01/fig11/swr_isccp_tropflux_correlation_fig10.pro
r100 r175 13 13 ; sst corrected on OAFLUX grid 14 14 ; has been produced by 15 ; : ref:`sst_correction_ncdf.pro`.15 ; :func:`sst_correction_ncdf`. 16 16 ; 17 17 ; :file:`${PROJECT_OD}/correlation_isccp_olr.idl` -
trunk/src/paper01/fig11/swr_isccp_tropflux_new_v1.pro
r100 r175 14 14 ; sst corrected on OAFLUX grid 15 15 ; has been produced by 16 ; : ref:`sst_correction_ncdf.pro`.16 ; :func:`sst_correction_ncdf`. 17 17 ; 18 18 ; ++ are written in -
trunk/src/paper01/fig13/net_flux_validation_scatter_2000_2007.pro
r174 r175 24 24 ; ; containing ++ 25 25 ; has been produced by 26 ; : ref:`TropFlux_19890101_20091231.pro`.26 ; :func:`tropflux`. 27 27 ; 28 28 ; .. graphviz:: -
trunk/src/paper01/fig16/fig16_timeseries_nino3.pro
r97 r175 13 13 ; sst corrected on OAFLUX grid 14 14 ; has been produced by 15 ; : ref:`sst_correction_ncdf.pro`.15 ; :func:`sst_correction_ncdf`. 16 16 ; 17 17 ; :file:`${PROJECT_OD}/netflux_nino3_1989_2007.idl` -
trunk/src/q2m_correction_ncdf.pro
r172 r175 1 1 ;+ 2 ;3 ; .. _q2m_correction_ncdf.pro:4 2 ; 5 3 ; ======================= … … 7 5 ; ======================= 8 6 ; 7 ; .. function:: q2m_correction_ncdf(yyyymmddb,yyyymmdde) 8 ; 9 9 ; DESCRIPTION 10 10 ; =========== … … 12 12 ; Correction of q2m on OAFLUX grid 13 13 ; 14 ; :file:`${PROJECT_OD}/erai_q2m_ 19890101_20091231_oafluxgrid.nc`14 ; :file:`${PROJECT_OD}/erai_q2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 15 15 ; containing 16 16 ; ++ … … 20 20 ; Corrected q2m on OAFLUX grid 21 21 ; is written in 22 ; :file:`${PROJECT_OD}/TropFlux_q2m_ 19890101_20091231.nc`22 ; :file:`${PROJECT_OD}/TropFlux_q2m_{yyyymmdd}_{yyyymmdd}.nc` 23 23 ; if this file not already exists. 24 24 ; 25 25 ; This file will be used by 26 ; : ref:`TropFlux_19890101_20091231.pro`.26 ; :func:`tropflux`. 27 27 ; 28 28 ; .. only:: man … … 36 36 ; digraph q2m_correction_ncdf { 37 37 ; 38 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_q2m_ 19890101_20091231_oafluxgrid.nc"];39 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_q2m_ 19890101_20091231.nc"];38 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_q2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 39 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_q2m_{yyyymmdd}_{yyyymmdd}.nc"]; 40 40 ; 41 41 ; q2m_correction_ncdf [shape=box, … … 52 52 ; ======== 53 53 ; 54 ; :ref:`mooring_corrections` 55 ; 56 ; Used by :ref:`tropflux.sh` 57 ; 54 58 ; :ref:`project_profile.sh` 55 ;56 ; :ref:`mooring_corrections`57 59 ; 58 60 ; :func:`d2m_to_q2m_erai` … … 69 71 ; :: 70 72 ; 71 ; IDL> q2m_correction_ncdf 73 ; IDL> yyyymmddb = 20000101L 74 ; IDL> yyyymmdde = 20001231L 75 ; IDL> result = q2m_correction_ncdf(yyyymmddb, yyyymmdde) 76 ; IDL> print, result 72 77 ; 73 78 ; TODO 74 79 ; ==== 75 80 ; 76 ; work on cratos idl7 even if NaNf values in erai_q2m_19890101_20091231_oafluxgrid.nc written by 77 ; d2m_to_q2m.pro. 81 ; make it work :: 82 ; 83 ; Writing fields: 84 ; q2m[longitude,latitude,time*]=q2m_new:q2m_attr; longitude[]=lon:lon_attr; latitude[]=lat:lat_attr; time[]=timein:time_attr @ globattr 85 ; % NCDF_DIMDEF: Unable to create dimension. (NC_ERROR=-59) 86 ; % NCDF_VARDEF: Unable to define variable, bad dimension id . 87 ; % NCDF_VARPUT: Variable Inquiry failed, -1 is not a valid variable id. 88 ; % Stop encountered: Q2M_CORRECTION_NCDF 1 89 ; /.autofs/lodyc/incas/fplod/tropflux/tropflux_ws/src/q2m_correction_ncdf.pro 78 90 ; 79 91 ; No way ... NaNf also in this output !! … … 88 100 ; $URL$ 89 101 ; 102 ; - fplod 20120322 103 ; 104 ; * taking project_overwite into account 105 ; * try to add compile_opt seems to be incompatible with ncdf_quickwrite 106 ; * pro -> function 107 ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters 108 ; * get rid of timegen 109 ; 90 110 ; - fplod 20110808T143129Z aedon.locean-ipsl.upmc.fr (Darwin) 91 111 ; … … 106 126 ; 107 127 ;- 108 pro q2m_correction_ncdf 128 function q2m_correction_ncdf $ 129 , yyyymmddb $ 130 , yyyymmdde 131 ; 132 ;++compile_opt idl2, strictarrsubs, logical_predicate 109 133 ; 110 134 @cm_4cal … … 114 138 @cm_project 115 139 ; 140 ; Return to caller if errors 141 ON_ERROR, 2 142 ; 143 result = -1 144 ; 145 usage = 'result = q2m_correction_ncdf(yyyymmddb, yyyymmdde)' 146 nparam = N_PARAMS() 147 IF (nparam NE 2) THEN BEGIN 148 ras = report(['Incorrect number of arguments.' $ 149 + '!C' $ 150 + 'Usage : ' + usage]) 151 return, result 152 ENDIF 153 116 154 ; test if ${PROJECT_OD} defined 117 155 CASE project_od_env OF … … 119 157 msg = 'eee : ${PROJECT_OD} is not defined' 120 158 ras = report(msg) 121 STOP159 return, result 122 160 END 123 161 ELSE: BEGIN … … 134 172 msg = 'eee : the directory' + iodirout + ' is not accessible.' 135 173 ras = report(msg) 136 STOP174 return, result 137 175 ENDIF 138 176 ; … … 141 179 msg = 'eee : the directory' + iodirout + ' was not found.' 142 180 ras = report(msg) 143 STOP 144 ENDIF 145 ; 146 da1=19880101 147 da2=20101231 181 return, result 182 ENDIF 148 183 ; 149 184 ; build data filename 150 filename='erai_q2m_ 19890101_20091231_oafluxgrid.nc'185 filename='erai_q2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 151 186 ; 152 187 ; check if this file exists … … 157 192 msg = 'eee : the file ' + fullfilename + ' was not found.' 158 193 ras = report(msg) 159 STOP194 return, result 160 195 ENDIF 161 196 ; 162 197 ; build output filename 163 filename_out = 'TropFlux_q2m_ 19890101_20091231.nc'198 filename_out = 'TropFlux_q2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 164 199 fullfilename_out = iodirout + filename_out 165 200 ; in order to avoid unexpected overwritten 166 IF ( FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN201 IF ((FILE_TEST(fullfilename_out) EQ 1) AND (project_overwrite EQ 0)) THEN BEGIN 167 202 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 168 203 ras = report(msg) 169 STOP204 return, result 170 205 ENDIF 171 206 ; 172 207 initncdf, fullfilename 173 q2m=read_ncdf('q2m',da1,da2,file=fullfilename,/nostr) 208 q2m=read_ncdf('q2m',yyyymmddb-.5d,yyyymmdde,file=fullfilename,/nostr) 209 timein=24.d*(time-julday(1,1,1957,0,0,0)) 210 jpt=n_elements(timein) 211 da=jul2date(time[0]) 212 cda0=string(da,format='(i8.8)') 213 da=jul2date(time[jpt-1]) 214 cda1=string(da,format='(i8.8)') 215 print, 'q2m in q2m_correction_ncdf first date ', cda0 216 print, 'q2m in q2m_correction_ncdf last date ' , cda1 217 ; 174 218 help, q2m 175 219 ; … … 182 226 ; 183 227 for jt=0,jpt-1 do begin 184 jtt=(time (jt)-julday(1,1,yea(jt))) < 364185 q=reform(q2m_mean (*,*))186 q2m_m (*,*,jt)=q228 jtt=(time[jt]-julday(1,1,yea[jt])) < 364 229 q=reform(q2m_mean[*,*]) 230 q2m_m[*,*,jt]=q 187 231 endfor 188 232 help, q2m_m … … 203 247 ; 204 248 ;writing field 205 lat=reform(gphit(0,0:jpj-1)) 206 lon=reform(glamt(0:jpi-1,0)) 207 time=timegen(7670, start=julday(1,1,1989,0), units='days') 208 jpt=n_elements(time) 209 ; 210 cda0=string(jul2date(time(0)),format='(i8.8)') 211 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 212 ; 213 time=time-julday(1,1,1950) 214 jpt=n_elements(time) 249 lat=reform(gphit[0,0:jpj-1]) 250 lon=reform(glamt[0:jpi-1,0]) 215 251 ; 216 252 ncfile='!' + fullfilename_out … … 221 257 q2m_attr={units:'g/kg',missing_value:1.e20,long_name:'Specific humidity at 2m height',short_name:'q2m',axis:'TYX'} 222 258 ; 223 ncfields = 'q2m[longitude,latitude,time ]=q2m_new:q2m_attr; ' $259 ncfields = 'q2m[longitude,latitude,time*]=q2m_new:q2m_attr; ' $ 224 260 + 'longitude[]=lon:lon_attr; ' $ 225 261 + 'latitude[]=lat:lat_attr; ' $ 226 + 'time[ *time]=time:time_attr ' $262 + 'time[]=timein:time_attr ' $ 227 263 + ' @ globattr' 228 264 ; 229 265 @ncdf_quickwrite 230 266 ; 267 result = 0 268 return, result 269 ; 231 270 end -
trunk/src/sst_correction_ncdf.pro
r174 r175 1 1 ;+ 2 ;3 ; .. _sst_correction_ncdf.pro:4 2 ; 5 3 ; ======================= … … 7 5 ; ======================= 8 6 ; 7 ; .. function:: sst_correction_ncdf(yyyymmddb,yyyymmdde) 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 9 12 ; Correction of sst on OAFLUX grid 10 13 ; 11 ; :file:`${PROJECT_OD}/erai_sst_ 19890101_20091231_oafluxgrid.nc`14 ; :file:`${PROJECT_OD}/erai_sst_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 12 15 ; containing 13 16 ; ++ … … 17 20 ; Corrected sst on OAFLUX grid 18 21 ; is written in 19 ; :file:`${PROJECT_OD}/TropFlux_sst_ 19890101_20091231.nc`22 ; :file:`${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc` 20 23 ; if this file not already exists. 21 24 ; 22 25 ; This output file 23 ; :file:`${PROJECT_OD}/TropFlux_sst_ 19890101_20091231.nc`26 ; :file:`${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc` 24 27 ; will be used by 25 28 ; :func:`cronin_gustiness_ncdf` 26 29 ; and 27 ; : ref:`TropFlux_19890101_20091231.pro`.30 ; :func:`tropflux`. 28 31 ; 29 32 ; This output file 30 ; :file:`${PROJECT_OD}/TropFlux_sst_ 19890101_20091231.nc`33 ; :file:`${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc` 31 34 ; is one of the deliverable of TropFlux. 32 35 ; … … 41 44 ; digraph sst_correction_ncdf { 42 45 ; 43 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_sst_ 19890101_20091231_oafluxgrid.nc"];44 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_ 19890101_20091231.nc"];46 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_sst_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 47 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc"]; 45 48 ; 46 49 ; sst_correction_ncdf [shape=box, … … 57 60 ; ======== 58 61 ; 62 ; :ref:`mooring_corrections` 63 ; 64 ; Used by :ref:`tropflux.sh` 65 ; 59 66 ; :ref:`project_profile.sh` 60 ;61 ; :ref:`mooring_corrections`62 67 ; 63 68 ; :func:`interp_erai_sst` … … 74 79 ; :: 75 80 ; 76 ; IDL> sst_correction_ncdf 81 ; IDL> yyyymmddb = 20000101L 82 ; IDL> yyyymmdde = 20001231L 83 ; IDL> result = sst_correction_ncdf(yyyymmddb, yyyymmdde) 84 ; IDL> print, result 77 85 ; 78 86 ; TODO … … 80 88 ; 81 89 ; make it work on loholt1 idl8: 82 ; reach end wh tiout error but with bad values (9.96921e+36 on time and sst, nb timestep 571690 ; reach end whithout error but with bad values (9.96921e+36 on time and sst, nb timestep 5716 83 91 ; 84 92 ; see commands:: … … 156 164 ; $URL$ 157 165 ; 166 ; - fplod 20120322 167 ; 168 ; * taking project_overwite into account 169 ; * try to add compile_opt seems to be incompatible with ncdf_quickwrite 170 ; * pro -> function 171 ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters 172 ; * get rid of timegen 173 ; 158 174 ; - fplod 20110808T124236Z cratos (Linux) 159 175 ; … … 175 191 ; 176 192 ;- 177 pro sst_correction_ncdf 193 function sst_correction_ncdf $ 194 , yyyymmddb $ 195 , yyyymmdde 196 ; 197 ;++compile_opt idl2, strictarrsubs, logical_predicate 178 198 ; 179 199 @cm_4cal … … 183 203 @cm_project 184 204 ; 205 ; Return to caller if errors 206 ON_ERROR, 2 207 ; 208 result = -1 209 ; 210 usage = 'result = sst_correction_ncdf(yyyymmddb, yyyymmdde)' 211 nparam = N_PARAMS() 212 IF (nparam NE 2) THEN BEGIN 213 ras = report(['Incorrect number of arguments.' $ 214 + '!C' $ 215 + 'Usage : ' + usage]) 216 return, result 217 ENDIF 218 ; 185 219 ; test if ${PROJECT_OD} defined 186 220 CASE project_od_env OF … … 188 222 msg = 'eee : ${PROJECT_OD} is not defined' 189 223 ras = report(msg) 190 STOP224 return, result 191 225 END 192 226 ELSE: BEGIN … … 203 237 msg = 'eee : the directory' + iodirout + ' is not accessible.' 204 238 ras = report(msg) 205 STOP239 return, result 206 240 ENDIF 207 241 ; … … 210 244 msg = 'eee : the directory' + iodirout + ' was not found.' 211 245 ras = report(msg) 212 STOP 213 ENDIF 214 ; 215 da1=19880101 216 da2=20091231 246 return, result 247 ENDIF 217 248 ; 218 249 ; build data filename 219 filename='erai_sst_ 19890101_20091231_oafluxgrid.nc'250 filename='erai_sst_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 220 251 ; 221 252 ; check if this file exists … … 226 257 msg = 'eee : the file ' + fullfilename + ' was not found.' 227 258 ras = report(msg) 228 STOP259 return, result 229 260 ENDIF 230 261 ; 231 262 ; build output filename 232 filename_out = 'TropFlux_sst_ 19890101_20091231.nc'263 filename_out = 'TropFlux_sst_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 233 264 fullfilename_out = iodirout + filename_out 234 265 ; in order to avoid unexpected overwritten 235 IF ( FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN266 IF ((FILE_TEST(fullfilename_out) EQ 1) AND (project_overwrite EQ 0)) THEN BEGIN 236 267 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 237 268 ras = report(msg) 238 STOP269 return, result 239 270 ENDIF 240 271 ; 241 272 initncdf, fullfilename 242 sst=read_ncdf('sst',da1,da2,file=fullfilename,/nostr) 273 sst=read_ncdf('sst',yyyymmddb-.5d,yyyymmdde,file=fullfilename,/nostr) 274 timein=24.d*(time-julday(1,1,1957,0,0,0)) 275 jpt=n_elements(timein) 276 da=jul2date(time[0]) 277 cda0=string(da,format='(i8.8)') 278 da=jul2date(time[jpt-1]) 279 cda1=string(da,format='(i8.8)') 280 print, 'sst in sst_correction_ncdf first date ', cda0 281 print, 'sst in sst_correction_ncdf last date ' , cda1 282 ; 243 283 sst=sst-273.15 244 284 help, sst … … 250 290 caldat, time,mon,day,yea 251 291 ; 252 ; debug to understand some time value 9.9692100e+36 on idl 6 lohloht1253 print, time[7080:7090]292 ;++ debug to understand some time value 9.9692100e+36 on idl 6 lohloht1 293 ; print, time[7080:7090] when working on [19890101,19891231] 254 294 ; 255 295 sst_m=sst*0. 256 296 ; 257 297 for jt=0,jpt-1 do begin 258 jtt=(time (jt)-julday(1,1,yea(jt))) < 364259 t=reform(sst_mean (*,*))260 sst_m (*,*,jt)=t298 jtt=(time[jt]-julday(1,1,yea[jt])) < 364 299 t=reform(sst_mean[*,*]) 300 sst_m[*,*,jt]=t 261 301 endfor 262 302 help, sst_m … … 278 318 ; 279 319 ;writing field 280 lat=reform(gphit(0,0:jpj-1)) 281 lon=reform(glamt(0:jpi-1,0)) 282 time=timegen(7670, start=julday(1,1,1989,0), units='days') 283 jpt=n_elements(time) 284 ; 285 cda0=string(jul2date(time(0)),format='(i8.8)') 286 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 287 ; 288 time=time-julday(1,1,1950) 289 jpt=n_elements(time) 320 lat=reform(gphit[0,0:jpj-1]) 321 lon=reform(glamt[0:jpi-1,0]) 290 322 ; 291 323 ncfile='!' + fullfilename_out … … 296 328 sst_attr={units:'degK',missing_value:1.e20,long_name:'Sea Surface Temperature',short_name:'sst',axis:'TYX'} 297 329 ; 298 ncfields = 'sst[longitude,latitude, time]=sst_new:sst_attr; ' $330 ncfields = 'sst[longitude,latitude,*time]=sst_new:sst_attr; ' $ 299 331 + 'longitude[]=lon:lon_attr; ' $ 300 332 + 'latitude[]=lat:lat_attr; ' $ 301 + 'time[ *time]=time:time_attr ' $333 + 'time[]=timein:time_attr ' $ 302 334 + ' @ globattr' 303 335 ; 304 336 @ncdf_quickwrite 305 337 ; 338 result = 0 339 return, result 340 ; 306 341 end -
trunk/src/t2m_correction_ncdf.pro
r155 r175 1 1 ;+ 2 ;3 ; .. _t2m_correction_ncdf.pro:4 2 ; 5 3 ; ======================= … … 7 5 ; ======================= 8 6 ; 7 ; .. function:: t2m_correction_ncdf(yyyymmddb,yyyymmdde) 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 9 12 ; Mean correction for air temperature bias and correction for variability are 10 13 ; applied. 11 14 ; 12 ; :file:`${PROJECT_ID}/erai_t2m_ 19890101_20091231_oafluxgrid.nc`15 ; :file:`${PROJECT_ID}/erai_t2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 13 16 ; containing 14 17 ; air temperature at 2 m height from ERA-I interpolated on OAFLUX grid … … 18 21 ; Corrected air temperature at 2 m height 19 22 ; is written in 20 ; :file:`${PROJECT_OD}/TropFlux_t2m_ 19890101_20091231.nc`23 ; :file:`${PROJECT_OD}/TropFlux_t2m_{yyyymmdd}_{yyyymmdd}.nc` 21 24 ; if this file not already exists. 22 25 ; 23 26 ; This output file 24 ; :file:`${PROJECT_OD}/TropFlux_t2m_ 19890101_20091231.nc`27 ; :file:`${PROJECT_OD}/TropFlux_t2m_{yyyymmdd}_{yyyymmdd}.nc` 25 28 ; will be used by 26 ; : ref:`TropFlux_19890101_20091231.pro`.29 ; :func:`tropflux`. 27 30 ; 28 31 ; .. only:: man … … 36 39 ; digraph t2m_correction_ncdf { 37 40 ; 38 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_t2m_ 19890101_20091231_oafluxgrid.nc"];39 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_t2m_ 19890101_20091231.nc"];41 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_t2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 42 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_t2m_{yyyymmdd}_{yyyymmdd}.nc"]; 40 43 ; 41 44 ; t2m_correction_ncdf [shape=box, … … 52 55 ; ======== 53 56 ; 57 ; :ref:`mooring_corrections` 58 ; 59 ; Used by :ref:`tropflux.sh` 60 ; 54 61 ; :ref:`project_profile.sh` 55 ;56 ; :ref:`mooring_corrections`57 62 ; 58 63 ; :func:`interp_erai_t2m` … … 72 77 ; :: 73 78 ; 74 ; IDL> t2m_correction_ncdf 79 ; IDL> yyyymmddb = 20000101L 80 ; IDL> yyyymmdde = 20001231L 81 ; IDL> result = t2m_correction_ncdf(yyyymmddb, yyyymmdde) 82 ; IDL> print, result 75 83 ; 76 84 ; TODO … … 97 105 ; check time values 98 106 ; 99 ; hard coded time in module name and in output filename100 ;101 107 ; hard coded correction values 102 108 ; … … 121 127 ; 122 128 ; $URL$ 129 ; 130 ; - fplod 20120322 131 ; 132 ; * taking project_overwite into account 133 ; * try to add compile_opt seems to be incompatible with ncdf_quickwrite 134 ; * pro -> function 135 ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters 136 ; * replace t2m=ncdf_lec(... by a t2m=read_ncdf( 123 137 ; 124 138 ; - fplod 20110822T112525Z aedon.locean-ipsl.upmc.fr (Darwin) … … 156 170 ; 157 171 ;- 158 pro t2m_correction_ncdf 172 function t2m_correction_ncdf $ 173 , yyyymmddb $ 174 , yyyymmdde 175 ; 176 ;++compile_opt idl2, strictarrsubs, logical_predicate 159 177 ; 160 178 @cm_4cal … … 164 182 @cm_project 165 183 ; 184 ; Return to caller if errors 185 ON_ERROR, 2 186 ; 187 result = -1 188 ; 189 usage = 'result = sst_correction_ncdf(yyyymmddb, yyyymmdde)' 190 nparam = N_PARAMS() 191 IF (nparam NE 2) THEN BEGIN 192 ras = report(['Incorrect number of arguments.' $ 193 + '!C' $ 194 + 'Usage : ' + usage]) 195 return, result 196 ENDIF 197 166 198 ; test if ${PROJECT_OD} defined 167 199 CASE project_id_env OF … … 169 201 msg = 'eee : ${PROJECT_OD} is not defined' 170 202 ras = report(msg) 171 STOP203 return, result 172 204 END 173 205 ELSE: BEGIN … … 184 216 msg = 'eee : the directory' + iodirout + ' is not accessible.' 185 217 ras = report(msg) 186 STOP218 return, result 187 219 ENDIF 188 220 ; … … 191 223 msg = 'eee : the directory' + iodirout + ' was not found.' 192 224 ras = report(msg) 193 STOP 194 ENDIF 195 ; 196 da1=19890101 197 da2=20091231 225 return, result 226 ENDIF 198 227 ; 199 228 ; build uncorrected t2 filename 200 229 filename_t2_uncor = 'erai_t2m_' $ 201 + string( da1,format='(i8.8)') $230 + string(yyyymmddb,format='(i8.8)') $ 202 231 + '_' $ 203 + string( da2,format='(i8.8)') $232 + string(yyyymmdde,format='(i8.8)') $ 204 233 + '_oafluxgrid.nc' 205 234 ; … … 211 240 msg = 'eee : the file ' + fullfilename_t2_uncor + ' was not found.' 212 241 ras = report(msg) 213 STOP242 return, result 214 243 ENDIF 215 244 ; 216 245 ; build output filename 217 246 filename_out = 'TropFlux_t2m_' $ 218 + string( da1,format='(i8.8)') $247 + string(yyyymmddb,format='(i8.8)') $ 219 248 + '_' $ 220 + string( da2,format='(i8.8)') $249 + string(yyyymmdde,format='(i8.8)') $ 221 250 + '.nc' 222 251 ; 223 252 fullfilename_out = iodirout + filename_out 224 253 ; in order to avoid unexpected overwritten 225 IF ( FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN254 IF ((FILE_TEST(fullfilename_out) EQ 1) AND (project_overwrite EQ 0)) THEN BEGIN 226 255 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 227 256 ras = report(msg) 228 STOP257 return, result 229 258 ENDIF 230 259 ; … … 239 268 ; 240 269 ; find first and last dates yyyymmdd 241 ; they will be written in global attributes of output file242 270 da=jul2date(julday(01, 01, 1957,timein[0])) 243 271 cda0=string(da,format='(i8.8)') 244 272 da=jul2date(julday(01, 01, 1957,timein[jptin-1])) 245 273 cda1=string(da,format='(i8.8)') 246 print, 'f irst date ', cda0247 print, ' last date ' , cda1274 print, 'for time checking first date ', cda0 275 print, 'for time checking last date ' , cda1 248 276 ; 249 277 ; read t2 data 250 t2m=ncdf_lec(fullfilename_t2_uncor,var='t2m') 278 initncdf, fullfilename_t2_uncor 279 t2m=read_ncdf('t2m',yyyymmddb-.5d,yyyymmdde,file=fullfilename_t2_uncor,/nostr) 280 timein=24.d*(time-julday(1,1,1957,0,0,0)) 281 jpt=n_elements(timein) 282 da=jul2date(time[0]) 283 cda0=string(da,format='(i8.8)') 284 da=jul2date(time[jpt-1]) 285 cda1=string(da,format='(i8.8)') 286 print, 't2m in t2m_correction_ncdf first date ', cda0 287 print, 't2m in t2m_correction_ncdf last date ' , cda1 251 288 ; 252 289 t2m=t2m-273.15 … … 267 304 ;++print,day 268 305 jtt=(julday(01, 01, 1957,timein[jt])-julday(1,1,yea)) < 364 269 t=reform(t2m_mean (*,*))270 t2m_m (*,*,jt)=t271 bias_cor (*,*,jt)=(((t-22.6)*0.4004896/(28-22.6)) > 0.) <0.4 ; (2000-2009)306 t=reform(t2m_mean[*,*]) 307 t2m_m[*,*,jt]=t 308 bias_cor[*,*,jt]=(((t-22.6)*0.4004896/(28-22.6)) > 0.) <0.4 ; (2000-2009) 272 309 endfor 273 310 help, t2m_m,bias_cor … … 290 327 ; 291 328 ;writing field 292 lat=reform(gphit(0,0:jpj-1)) 293 lon=reform(glamt(0:jpi-1,0)) 294 cda0=string(da1) 295 cda1=string(da2) 296 ; 297 ; conversion for hours since 19570101 to days from 19500101 298 time=julday(01, 01, 1957,timein)-julday(1,1,1950) 299 jpt=n_elements(time) 329 lat=reform(gphit[0,0:jpj-1]) 330 lon=reform(glamt[0:jpi-1,0]) 300 331 ; 301 332 ncfile='!' + fullfilename_out … … 313 344 t2m_attr={units:units,missing_value:1.e20,long_name:long_name,short_name:'t2m',axis:'TYX'} 314 345 ; 315 ncfields = 't2m[longitude,latitude, time]=t2m_new:t2m_attr; ' $346 ncfields = 't2m[longitude,latitude,*time]=t2m_new:t2m_attr; ' $ 316 347 + 'longitude[]=lon:lon_attr; ' $ 317 348 + 'latitude[]=lat:lat_attr; ' $ 318 + 'time[ *time]=time:time_attr ' $349 + 'time[]=timein:time_attr ' $ 319 350 + ' @ globattr' 320 351 ; 321 352 @ncdf_quickwrite 322 353 ; 354 result = 0 355 return, result 356 ; 323 357 end -
trunk/src/tropflux.pro
- Property svn:keywords changed from URL to Id URL
r174 r175 1 1 ;+ 2 2 ; 3 ; .. _TropFlux_19890101_20091231.pro: 4 ; 5 ; ============================== 6 ; TropFlux_19890101_20091231.pro 7 ; ============================== 3 ; ============ 4 ; tropflux.pro 5 ; ============ 6 ; 7 ; .. function:: tropflux(yyyymmddb,yyyymmdde) 8 ; 9 ; DESCRITION 10 ; ========== 8 11 ; 9 12 ; This program computes net heat flux components on the 1° oaflux grid. … … 20 23 ; :func:`oaflux_mask_30n30s`. 21 24 ; 22 ; :file:`${PROJECT_OD}/TropFlux_sst_ 19890101_20091231.nc`25 ; :file:`${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc` 23 26 ; containing 24 27 ; sst corrected on OAFLUX grid 25 28 ; has been produced by 26 ; : ref:`sst_correction_ncdf.pro`.27 ; 28 ; :file:`${PROJECT_OD}/TropFlux_ws_ 19890101_20091231.nc`29 ; :func:`sst_correction_ncdf`. 30 ; 31 ; :file:`${PROJECT_OD}/TropFlux_ws_{yyyymmdd}_{yyyymmdd}.nc` 29 32 ; containing 30 33 ; ws corrected on OAFLUX grid 31 34 ; has been produced by 32 ; : ref:`ws_correction_ncdf.pro`.33 ; 34 ; :file:`${PROJECT_OD}/TropFlux_gustiness_ 19890101_20091231.nc`35 ; :func:`ws_correction_ncdf`. 36 ; 37 ; :file:`${PROJECT_OD}/TropFlux_gustiness_{yyyymmdd}_{yyyymmdd}.nc` 35 38 ; containing 36 39 ; ++ … … 38 41 ; :func:`cronin_gustiness_ncdf`. 39 42 ; 40 ; :file:`${PROJECT_OD}/TropFlux_swr_ 19890101_20091231_BLND.nc`43 ; :file:`${PROJECT_OD}/TropFlux_swr_{yyyymmdd}_{yyyymmdd}_BLND.nc` 41 44 ; containing 42 45 ; ws corrected on OAFLUX grid … … 44 47 ; :func:`tropflux_swr_blnd`. 45 48 ; 46 ; :file:`${PROJECT_OD}/TropFlux_lwr_ 19890101_20091231.nc`49 ; :file:`${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc` 47 50 ; containing 48 51 ; lwr corrected on OAFLUX grid 49 52 ; has been produced by 50 ; : ref:`lwr_correction_ncdf.pro`.53 ; :func:`lwr_correction_ncdf`. 51 54 ; 52 55 ; containing 53 56 ; t2m corrected on OAFLUX grid 54 57 ; has been produced by 55 ; : ref:`t2m_correction_ncdf.pro`.56 ; 57 ; :file:`${PROJECT_OD}/TropFlux_q2m_ 19890101_20091231.nc`58 ; :func:`t2m_correction_ncdf`. 59 ; 60 ; :file:`${PROJECT_OD}/TropFlux_q2m_{yyyymmdd}_{yyyymmdd}.nc` 58 61 ; containing 59 62 ; q2m corrected on OAFLUX grid … … 62 65 ; 63 66 ; net heat flux components are written 64 ; in :file:`${PROJECT_OD}/TropFlux_ 19890101_20091231_coarev3.nc`67 ; in :file:`${PROJECT_OD}/TropFlux_{yyyymmdd}_{yyyymmdd}_coarev3.nc` 65 68 ; if this file not already exists. 66 69 ; 67 70 ; This output file 68 ; :file:`${PROJECT_OD}/TropFlux_ 19890101_20091231_coarev3.nc`71 ; :file:`${PROJECT_OD}/TropFlux_{yyyymmdd}_{yyyymmdd}_coarev3.nc` 69 72 ; will be used by 70 73 ; :ref:`TropFlux_NRT_ncdf.pro`. … … 72 75 ; .. graphviz:: 73 76 ; 74 ; digraph tropflux _19890101_20091231{77 ; digraph tropflux { 75 78 ; 76 79 ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; 77 ; file_sst [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_ 19890101_20091231.nc"];78 ; file_ws [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ws_ 19890101_20091231.nc"];79 ; file_wg [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_ 19890101_20091231.nc"];80 ; file_swr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_ 19890101_20091231_BLND.nc"];81 ; file_lwr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_ 19890101_20091231.nc"];82 ; file_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_t2m_ 19890101_20091231.nc"];83 ; file_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_q2m_ 19890101_20091231.nc"];84 ; 85 ; file_out[shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ 19890101_20091231_coarev3.nc"];86 ; 87 ; tropflux _19890101_20091231[shape=box,80 ; file_sst [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_{yyyymmdd}_{yyyymmdd}.nc"]; 81 ; file_ws [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ws_{yyyymmdd}_{yyyymmdd}.nc"]; 82 ; file_wg [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_{yyyymmdd}_{yyyymmdd}.nc"]; 83 ; file_swr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_{yyyymmdd}_{yyyymmdd}_BLND.nc"]; 84 ; file_lwr [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_{yyyymmdd}_{yyyymmdd}.nc"]; 85 ; file_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_t2m_{yyyymmdd}_{yyyymmdd}.nc"]; 86 ; file_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_q2m_{yyyymmdd}_{yyyymmdd}.nc"]; 87 ; 88 ; file_out[shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_{yyyymmdd}_{yyyymmdd}_coarev3.nc"]; 89 ; 90 ; tropflux [shape=box, 88 91 ; fontname=Courier, 89 92 ; color=blue, 90 ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/ TropFlux_19890101_20091231.pro",91 ; label="${PROJECT}/src/ TropFlux_19890101_20091231.pro"];92 ; 93 ; {mask file_sst file_ws file_wg file_swr file_lwr file_t2m file_q2m} -> {tropflux _19890101_20091231} -> {file_out}93 ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/tropflux.pro", 94 ; label="${PROJECT}/src/tropflux.pro"]; 95 ; 96 ; {mask file_sst file_ws file_wg file_swr file_lwr file_t2m file_q2m} -> {tropflux} -> {file_out} 94 97 ; 95 98 ; } … … 99 102 ; 100 103 ; :ref:`project_profile.sh` 104 ; 105 ; Used by :ref:`tropflux.sh` 101 106 ; 102 107 ; :func:`report <saxo:report>` … … 124 129 ; :: 125 130 ; 126 ; IDL> .compile TropFlux_19890101_20091231 127 ; IDL> tropflux_19890101_20091231 128 ; 131 ; IDL> yyyymmddb = 20000101L 132 ; IDL> yyyymmdde = 20001231L 133 ; IDL> result = tropflux(yyyymmddb, yyyymmdde) 134 ; IDL> print, result 135 129 136 ; TODO 130 137 ; ==== 131 138 ; 132 139 ; describe usage of tau 140 ; 141 ; compare time between all inputs after reading 133 142 ; 134 143 ; make it work :: … … 180 189 ; wg=read_ncdf('wg',da1-1,da2,file=fullfilename_wg,/nostr) 181 190 ; 182 ; avoid mix lower/uppercase in pro name to avoid compile183 ;184 191 ; coding rules 185 192 ; … … 196 203 ; 197 204 ; $URL$ 205 ; 206 ; - fplod 20120322 207 ; 208 ; * pro -> func 209 ; * rename with lower case TropFlux_19890101_20091231 become tropflux 210 ; * taking project_overwite into account 211 ; * try to add compile_opt 212 ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters 213 ; * get rid of timegen 198 214 ; 199 215 ; - fplod 20110830T135832Z cratos (Linux) … … 241 257 ;- 242 258 ; 243 pro TropFlux_19890101_20091231 259 function tropflux $ 260 , yyyymmddb $ 261 , yyyymmdde 262 ; 263 compile_opt idl2, strictarrsubs, logical_predicate 244 264 ; 245 265 @cm_4cal … … 249 269 @cm_project 250 270 ; 271 ; Return to caller if errors 272 ON_ERROR, 2 273 ; 274 result = -1 275 ; 276 usage = 'result = tropflux_swr_nrt(yyyymmddb, yyyymmdde)' 277 nparam = N_PARAMS() 278 IF (nparam NE 2) THEN BEGIN 279 ras = report(['Incorrect number of arguments.' $ 280 + '!C' $ 281 + 'Usage : ' + usage]) 282 return, result 283 ENDIF 284 ; 251 285 ; check for input directory 252 286 ; … … 256 290 msg = 'eee : ${PROJECT_ID} is not defined' 257 291 ras = report(msg) 258 STOP292 return, result 259 293 END 260 294 ELSE: BEGIN … … 270 304 msg = 'eee : the directory' + iodirin + ' is not accessible.' 271 305 ras = report(msg) 272 STOP306 return, result 273 307 ENDIF 274 308 ; … … 283 317 msg = 'eee : the file ' + fullfilename_msk + ' was not found.' 284 318 ras = report(msg) 285 STOP319 return, result 286 320 ENDIF 287 321 ; … … 291 325 msg = 'eee : ${PROJECT_OD} is not defined' 292 326 ras = report(msg) 293 STOP327 return, result 294 328 END 295 329 ELSE: BEGIN … … 306 340 msg = 'eee : the directory' + iodirout + ' is not accessible.' 307 341 ras = report(msg) 308 STOP342 return, result 309 343 ENDIF 310 344 ; … … 313 347 msg = 'eee : the directory' + iodirout + ' was not found.' 314 348 ras = report(msg) 315 STOP349 return, result 316 350 ENDIF 317 351 ; 318 352 ; build sst data filename 319 filename_sst='TropFlux_sst_ 19890101_20091231.nc'353 filename_sst='TropFlux_sst_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 320 354 ; 321 355 ; check if this file exists … … 326 360 msg = 'eee : the file ' + fullfilename_sst + ' was not found.' 327 361 ras = report(msg) 328 STOP362 return, result 329 363 ENDIF 330 364 ; 331 365 ; build ws data filename 332 filename_ws='TropFlux_ws_ 19890101_20091231.nc'366 filename_ws='TropFlux_ws_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 333 367 ; 334 368 ; check if this file exists … … 339 373 msg = 'eee : the file ' + fullfilename_ws + ' was not found.' 340 374 ras = report(msg) 341 STOP375 return, result 342 376 ENDIF 343 377 ; 344 378 ; build swr data filename 345 filename_swr='TropFlux_swr_ 19890101_20091231_BLND.nc'379 filename_swr='TropFlux_swr_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_BLND.nc' 346 380 ; 347 381 ; check if this file exists … … 352 386 msg = 'eee : the file ' + fullfilename_swr + ' was not found.' 353 387 ras = report(msg) 354 STOP388 return, result 355 389 ENDIF 356 390 ; 357 391 ; build lwr data filename 358 filename_lwr='TropFlux_lwr_ 19890101_20091231.nc'392 filename_lwr='TropFlux_lwr_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 359 393 ; 360 394 ; check if this file exists … … 365 399 msg = 'eee : the file ' + fullfilename_lwr + ' was not found.' 366 400 ras = report(msg) 367 STOP401 return, result 368 402 ENDIF 369 403 ; 370 404 ; build t2m data filename 371 filename_t2m='TropFlux_t2m_ 19890101_20091231.nc'405 filename_t2m='TropFlux_t2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 372 406 ; 373 407 ; check if this file exists … … 378 412 msg = 'eee : the file ' + fullfilename_t2m + ' was not found.' 379 413 ras = report(msg) 380 STOP414 return, result 381 415 ENDIF 382 416 ; 383 417 ; build q2m data filename 384 filename_q2m='TropFlux_q2m_ 19890101_20091231.nc'418 filename_q2m='TropFlux_q2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 385 419 ; 386 420 ; check if this file exists … … 391 425 msg = 'eee : the file ' + fullfilename_q2m + ' was not found.' 392 426 ras = report(msg) 393 STOP427 return, result 394 428 ENDIF 395 429 ; 396 430 ; build wg data filename 397 filename_wg='TropFlux_gustiness_ 19890101_20091231.nc'431 filename_wg='TropFlux_gustiness_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '.nc' 398 432 ; 399 433 ; check if this file exists … … 404 438 msg = 'eee : the file ' + fullfilename_wg + ' was not found.' 405 439 ras = report(msg) 406 STOP440 return, result 407 441 ENDIF 408 442 ; 409 443 ; build output filename 410 filename_out = 'TropFlux_ 19890101_20091231_coarev3.nc'444 filename_out = 'TropFlux_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_coarev3.nc' 411 445 fullfilename_out = iodirout + filename_out 412 446 ; in order to avoid unexpected overwritten … … 414 448 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 415 449 ras = report(msg) 416 STOP 417 ENDIF 418 ; 419 da1=19880101 420 da2=20101231 450 return, result 451 ENDIF 421 452 ; 422 453 initncdf, fullfilename_msk … … 425 456 initncdf, fullfilename_sst 426 457 ; 427 ws=read_ncdf('ws',da1,da2,file=fullfilename_ws,/nostr) 428 wg=read_ncdf('wg',da1-1,da2,file=fullfilename_wg,/nostr) 458 ws=read_ncdf('ws',yyyymmddb-.5d,yyyymmdde,file=fullfilename_ws,/nostr) 459 timein=24.d*(time-julday(1,1,1957,0,0,0)) 460 jpt=n_elements(timein) 461 da=jul2date(time[0]) 462 cda0=string(da,format='(i8.8)') 463 da=jul2date(time[jpt-1]) 464 cda1=string(da,format='(i8.8)') 465 print, 'ws in tropflux first date ', cda0 466 print, 'ws in ws_correction_ncdf last date ' , cda1 467 ; 468 wg=read_ncdf('wg',yyyymmddb-.5d-1,yyyymmdde,file=fullfilename_wg,/nostr) 469 timein=24.d*(time-julday(1,1,1957,0,0,0)) 470 jpt=n_elements(timein) 471 da=jul2date(time[0]) 472 cda0=string(da,format='(i8.8)') 473 da=jul2date(time[jpt-1]) 474 cda1=string(da,format='(i8.8)') 475 print, 'wg in tropflux first date ', cda0 476 print, 'wg in ws_correction_ncdf last date ' , cda1 429 477 tt=time 430 478 jpt=n_elements(time) 431 sst=read_ncdf('sst',da1,da2,file=fullfilename_sst,/nostr) 479 sst=read_ncdf('sst',yyyymmddb-.5d,yyyymmdde,file=fullfilename_sst,/nostr) 480 timein=24.d*(time-julday(1,1,1957,0,0,0)) 481 jpt=n_elements(timein) 482 da=jul2date(time[0]) 483 cda0=string(da,format='(i8.8)') 484 da=jul2date(time[jpt-1]) 485 cda1=string(da,format='(i8.8)') 486 print, 'sst in tropflux first date ', cda0 487 print, 'sst in ws_correction_ncdf last date ' , cda1 432 488 sst=reform(sst-273.15) 433 swd=read_ncdf('swr',da1,da2,file=fullfilename_swr,/nostr) 434 lw=read_ncdf('lwr',da1,da2,file=fullfilename_lwr,/nostr) 489 swd=read_ncdf('swr',yyyymmddb-.5d,yyyymmdde,file=fullfilename_swr,/nostr) 490 timein=24.d*(time-julday(1,1,1957,0,0,0)) 491 jpt=n_elements(timein) 492 da=jul2date(time[0]) 493 cda0=string(da,format='(i8.8)') 494 da=jul2date(time[jpt-1]) 495 cda1=string(da,format='(i8.8)') 496 print, 'swr in tropflux first date ', cda0 497 print, 'swr in ws_correction_ncdf last date ' , cda1 498 lw=read_ncdf('lwr',yyyymmddb-.5d,yyyymmdde,file=fullfilename_lwr,/nostr) 499 timein=24.d*(time-julday(1,1,1957,0,0,0)) 500 jpt=n_elements(timein) 501 da=jul2date(time[0]) 502 cda0=string(da,format='(i8.8)') 503 da=jul2date(time[jpt-1]) 504 cda1=string(da,format='(i8.8)') 505 print, 'lwr in tropflux first date ', cda0 506 print, 'lwr in ws_correction_ncdf last date ' , cda1 435 507 swd=swd/0.94 ; converting from net swr to downward swr 436 508 ; 437 t2m=read_ncdf('t2m',da1,da2,file=fullfilename_t2m,/nostr)-273.15 ; in C 438 q2m=read_ncdf('q2m',da1,da2,file=fullfilename_q2m,/nostr) ; in g/kg 509 t2m=read_ncdf('t2m',yyyymmddb-.5d,yyyymmdde,file=fullfilename_t2m,/nostr)-273.15 ; in C 510 timein=24.d*(time-julday(1,1,1957,0,0,0)) 511 jpt=n_elements(timein) 512 da=jul2date(time[0]) 513 cda0=string(da,format='(i8.8)') 514 da=jul2date(time[jpt-1]) 515 cda1=string(da,format='(i8.8)') 516 print, 't2m in tropflux first date ', cda0 517 print, 't2m in ws_correction_ncdf last date ' , cda1 518 q2m=read_ncdf('q2m',yyyymmddb-.5d,yyyymmdde,file=fullfilename_q2m,/nostr) ; in g/kg 519 timein=24.d*(time-julday(1,1,1957,0,0,0)) 520 jpt=n_elements(timein) 521 da=jul2date(time[0]) 522 cda0=string(da,format='(i8.8)') 523 da=jul2date(time[jpt-1]) 524 cda1=string(da,format='(i8.8)') 525 print, 'q2m in tropflux first date ', cda0 526 print, 'q2m in ws_correction_ncdf last date ' , cda1 439 527 ; 440 528 w=sqrt(ws*ws+wg*wg) ; wind corrected for gustiness … … 471 559 ; 472 560 for jt=0,jpt-1 do begin 473 jday=time (jt)-julday(1,1,yea(jt))561 jday=time[jt]-julday(1,1,yea[jt]) 474 562 print, 'Computing Fluxes ',jt,' / ',jpt-1 475 563 ; … … 478 566 ; 479 567 ; wind speed (m/s) 480 wn=w (*,*,jt)481 wn=wn (ocean)568 wn=w[*,*,jt] 569 wn=wn[ocean] 482 570 ; Bulk sst (°C) 483 ts=sst (*,*,jt)484 ts=ts (ocean)571 ts=sst[*,*,jt] 572 ts=ts[ocean] 485 573 ; 2m Air T (°C) 486 t=t2m (*,*,jt)487 t=t (ocean)574 t=t2m[*,*,jt] 575 t=t[ocean] 488 576 ; Sea surface sat. spec. humidity (g/kg) 489 577 qs=qsee(ts,P) 490 578 ; 2m AIr specific humidity (g/kg) 491 q=q2m (*,*,jt)492 q=q (ocean)579 q=q2m[*,*,jt] 580 q=q[ocean] 493 581 ; Downward solar flux (W/m2) 494 Rs=swd (*,*,jt)495 Rs=Rs (ocean)496 ylat=gphit (ocean)582 Rs=swd[*,*,jt] 583 Rs=Rs[ocean] 584 ylat=gphit[ocean] 497 585 ; cld=calc_cloud(jday,Rs,ylat) 498 586 cld=calc_cloud_vlat(jday,Rs,ylat) 499 587 ; Downward IR flux (W/m2) 500 588 ; Rl=lwdown_clark(ts,q,cld,t,P) 501 Rl=lw (*,*,jt)502 Rl=Rl (ocean)589 Rl=lw[*,*,jt] 590 Rl=Rl[ocean] 503 591 rain=0. 504 592 lw_clrk=-lwnet_clark(ts,q,cld,t,P) 505 ; junk (*,*,jt)=lw_clrk593 ; junk[*,*,jt]=lw_clrk 506 594 ; 507 595 ;stop … … 509 597 ; A few punctual missing values (coare does not converge): filled by spatial extrapolation 510 598 tab=fltarr(jpi,jpj)+!values.f_nan 511 x=reform(y (*,0))512 tab (ocean)=x599 x=reform(y[*,0]) 600 tab[ocean]=x 513 601 m=finite(tab) 514 602 help, tab, m, swr 515 603 tab=extrapolate(tab,m) 516 swr (*,*,jt)=tab*msk+valmask*(1-msk)604 swr[*,*,jt]=tab*msk+valmask*(1-msk) 517 605 ; 518 606 tab=fltarr(jpi,jpj)+!values.f_nan 519 x=reform(y (*,1))520 tab (ocean)=x607 x=reform(y[*,1]) 608 tab[ocean]=x 521 609 m=finite(tab) 522 610 help, tab, m, lwr … … 524 612 print, 'www : extrapolation for lwr is not done' 525 613 tab=tab 526 lwr (*,*,jt)=tab*msk+valmask*(1-msk)614 lwr[*,*,jt]=tab*msk+valmask*(1-msk) 527 615 ; 528 616 tab=fltarr(jpi,jpj)+!values.f_nan 529 x=reform(y (*,2))530 tab (ocean)=x617 x=reform(y[*,2]) 618 tab[ocean]=x 531 619 m=finite(tab) 532 620 help, tab, m, lat … … 534 622 print, 'www : extrapolation for lat is not done' 535 623 tab=tab 536 lat (*,*,jt)=tab*msk+valmask*(1-msk)624 lat[*,*,jt]=tab*msk+valmask*(1-msk) 537 625 tab=fltarr(jpi,jpj)+!values.f_nan 538 x=reform(y (*,3))539 tab (ocean)=x626 x=reform(y[*,3]) 627 tab[ocean]=x 540 628 m=finite(tab) 541 629 help, tab, m, sen … … 543 631 print, 'www : extrapolation for sen is not done' 544 632 tab=tab 545 sen (*,*,jt)=tab*msk+valmask*(1-msk)546 ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(lw_clrk) & tab (ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & lwnet_clrk(*,*,jt)=tab*msk+valmask*(1-msk)547 tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y (*,5)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & tau(*,*,jt)=tab*msk+valmask*(1-msk)548 ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y (*,6)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & Ch(*,*,jt)=tab*msk+valmask*(1-msk)549 ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y (*,7)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & Ce(*,*,jt)=tab*msk+valmask*(1-msk)550 tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y (*,8)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & wg(*,*,jt)=tab*msk+valmask*(1-msk)633 sen[*,*,jt]=tab*msk+valmask*(1-msk) 634 ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(lw_clrk) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & lwnet_clrk[*,*,jt]=tab*msk+valmask*(1-msk) 635 tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,5]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & tau[*,*,jt]=tab*msk+valmask*(1-msk) 636 ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,6]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & Ch[*,*,jt]=tab*msk+valmask*(1-msk) 637 ; tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,7]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & Ce[*,*,jt]=tab*msk+valmask*(1-msk) 638 tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y[*,8]) & tab[ocean]=x & m=finite(tab) & tab=extrapolate(tab,m) & wg[*,*,jt]=tab*msk+valmask*(1-msk) 551 639 endfor 552 time=timegen(7670, start=julday(1,1,1989,0), units='days')553 640 jpt=n_elements(time) 554 641 ; 555 cda0=string(jul2date(time (0)),format='(i8.8)')556 cda1=string(jul2date(time (jpt-1)),format='(i8.8)')642 cda0=string(jul2date(time[0]),format='(i8.8)') 643 cda1=string(jul2date(time[jpt-1]),format='(i8.8)') 557 644 time=time-julday(1,1,1950,00,00,00) 558 xlon=reform(glamt (*,0))559 ylat=reform(gphit (0,*))645 xlon=reform(glamt[*,0]) 646 ylat=reform(gphit[0,*]) 560 647 ; 561 648 ncfile='!' + fullfilename_out … … 590 677 @ncdf_quickwrite 591 678 ; 679 result = 0 680 return, result 681 ; 592 682 end -
trunk/src/tropflux.sh
r174 r175 89 89 # 90 90 # Use : 91 # :func:`oaflux_mask_30n30s`, :func:`interp_erai_t2m`, 91 # :func:`oaflux_mask_30n30s`, :func:`interp_erai_t2m`, 92 92 # :func:`interp_erai_msl`, :func:`interp_erai_dewt`, :func:`interp_erai_lwr`, 93 # :func:`interp_erai_sst`, :func:`interp_erai_ws`, :func:`interp_olr_30n30s`, 94 # :func:`d2m_to_q2m_erai`, 93 # :func:`interp_erai_sst`, :func:`interp_erai_ws`, :func:`interp_olr_30n30s`, 94 # :func:`d2m_to_q2m_erai`, :func:`sst_correction_ncdf`, 95 # :func:`lwr_correction_ncdf`, :func:`q2m_correction_ncdf`, 96 # :func:`t2m_correction_ncdf`, :func:`ws_correction_ncdf`, 97 # :func:`tropflux_swr_dt`, :func:`tropflux_swr_nrt`, :func:`tropflux_swr_blnd`, 95 98 # etc. 96 99 # … … 114 117 # 115 118 # $URL$ 119 # 120 # - pinsard 20120322 121 # 122 # * handling error of sst_correction_ncdf (now function) 123 # * handling error of lwr_correction_ncdf (now function) 124 # * handling error of q2m_correction_ncdf (now function) 125 # * handling error of t2m_correction_ncdf (now function) 126 # * handling error of ws_correction_ncdf (now function) 116 127 # 117 128 # - pinsard 20120321 … … 382 393 exit 383 394 ENDIF 384 ;sst_correction_ncdf 395 result = sst_correction_ncdf(${yyyymmddb}, ${yyyymmdde}) 396 IF result < 0 THEN BEGIN 397 msg = 'eee : pb after sst_correction_ncdf ' + string(result) 398 err = report(msg) 399 exit 400 ENDIF 385 401 result = cronin_gustiness_ncdf(${yyyymmddb}, ${yyyymmdde}) 386 402 IF result < 0 THEN BEGIN 387 403 msg = 'eee : pb after cronin_gustiness_ncdf ' + string(result) 388 err = report(msg) 389 exit 404 err = report(msg) 405 exit 406 ENDIF 390 407 result = tropflux_swr_blnd(${yyyymmddb}, ${yyyymmdde}) 391 408 IF result < 0 THEN BEGIN 392 409 msg = 'eee : pb after tropflux_swr_blnd ' + string(result) 393 err = report(msg) 394 exit 395 ;lwr_correction_ncdf 396 ;q2m_correction_ncdf 397 ;t2m_correction_ncdf 398 ;ws_correction_ncdf 410 err = report(msg) 411 exit 412 ENDIF 413 result = lwr_correction_ncdf(${yyyymmddb}, ${yyyymmdde}) 414 IF result < 0 THEN BEGIN 415 msg = 'eee : pb after lwr_correction_ncdf ' + string(result) 416 err = report(msg) 417 exit 418 ENDIF 419 result = q2m_correction_ncdf(${yyyymmddb}, ${yyyymmdde}) 420 IF result < 0 THEN BEGIN 421 msg = 'eee : pb after q2m_correction_ncdf ' + string(result) 422 err = report(msg) 423 exit 424 ENDIF 425 result = t2m_correction_ncdf(${yyyymmddb}, ${yyyymmdde}) 426 IF result < 0 THEN BEGIN 427 msg = 'eee : pb after t2m_correction_ncdf ' + string(result) 428 err = report(msg) 429 exit 430 ENDIF 431 result = ws_correction_ncdf(${yyyymmddb}, ${yyyymmdde}) 432 IF result < 0 THEN BEGIN 433 msg = 'eee : pb after ws_correction_ncdf ' + string(result) 434 err = report(msg) 435 exit 436 ENDIF 399 437 ;.compile TropFlux_19890101_20091231 400 ;tropflux_19890101_20091231 438 result = tropflux(${yyyymmddb}, ${yyyymmdde}) 439 IF result < 0 THEN BEGIN 440 msg = 'eee : pb after tropflux' + string(result) 441 err = report(msg) 442 exit 443 ENDIF 401 444 ;.compile TropFlux_NRT_ncdf 402 445 ;tropflux_nrt_ncdf -
trunk/src/tropflux_swr_blnd.pro
r174 r175 53 53 ; ======== 54 54 ; 55 ; :ref:`mooring_corrections` 56 ; 57 ; Used by :ref:`tropflux.sh` 58 ; 55 59 ; :ref:`project_profile.sh` 56 ;57 ; :ref:`mooring_corrections`58 60 ; 59 61 ; :ref:`data_in_swr` -
trunk/src/tropflux_swr_nrt.pro
r174 r175 47 47 ; ======== 48 48 ; 49 ; :ref:`project_profile.sh`50 ;51 49 ; :ref:`mooring_corrections` 52 50 ; 53 51 ; :ref:`data_in_swr` 54 52 ; :ref:`data_in_olr` 53 ; 54 ; Used by :ref:`tropflux.sh` 55 ; 56 ; :ref:`project_profile.sh` 55 57 ; 56 58 ; :func:`initncdf <saxo:initncdf>` -
trunk/src/ws_correction_ncdf.pro
r172 r175 1 1 ;+ 2 ;3 ; .. _ws_correction_ncdf.pro:4 2 ; 5 3 ; ====================== … … 7 5 ; ====================== 8 6 ; 7 ; .. function:: ws_correction_ncdf(yyyymmddb,yyyymmdde) 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 9 12 ; Correction of ws on OAFLUX grid 10 13 ; 11 ; :file:`${PROJECT_OD}/erai_ws_ 19890101_20091231_oafluxgrid.nc`14 ; :file:`${PROJECT_OD}/erai_ws_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 12 15 ; containing 13 16 ; ++ … … 17 20 ; Corrected ws on OAFLUX grid 18 21 ; is written in 19 ; :file:`${PROJECT_OD}/TropFlux_ws_ 19890101_20091231.nc`22 ; :file:`${PROJECT_OD}/TropFlux_ws_{yyyymmdd}_{yyyymmdd}.nc` 20 23 ; if this file not already exists. 21 24 ; 22 25 ; This output file 23 ; :file:`${PROJECT_OD}/TropFlux_ws_ 19890101_20091231.nc`26 ; :file:`${PROJECT_OD}/TropFlux_ws_{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 ws_correction_ncdf { 36 39 ; 37 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_ws_ 19890101_20091231_oafluxgrid.nc"];38 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ws_ 19890101_20091231.nc"];40 ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_ws_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 41 ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_ws_{yyyymmdd}_{yyyymmdd}.nc"]; 39 42 ; 40 43 ; ws_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_ws` … … 69 74 ; :: 70 75 ; 71 ; IDL> ws_correction_ncdf 76 ; IDL> yyyymmddb = 20000101L 77 ; IDL> yyyymmdde = 20001231L 78 ; IDL> result = ws_correction_ncdf(yyyymmddb, yyyymmdde) 79 ; IDL> print, result 72 80 ; 73 81 ; TODO … … 90 98 ; 91 99 ; $URL$ 100 ; 101 ; - fplod 20120322 102 ; 103 ; * taking project_overwite into account 104 ; * try to add compile_opt seems to be incompatible with ncdf_quickwrite 105 ; * pro -> function 106 ; * hard coded da1 and da2 replaced by yyyymmddb and yyyymmdde parameters 107 ; * get rid of timegen 92 108 ; 93 109 ; - fplod 20110808T131954Z aedon.locean-ipsl.upmc.fr (Darwin) … … 110 126 ; 111 127 ;- 112 pro ws_correction_ncdf 113 ; 114 @cm_4cal 128 function ws_correction_ncdf $ 129 , yyyymmddb $ 130 , yyyymmdde 131 ; 132 ;++compile_opt idl2, strictarrsubs, logical_predicate 133 ; 115 134 @cm_4data 116 135 @cm_4mesh … … 118 137 @cm_project 119 138 ; 139 ; Return to caller if errors 140 ON_ERROR, 2 141 ; 142 result = -1 143 ; 144 usage = 'result = ws_correction_ncdf(yyyymmddb, yyyymmdde)' 145 nparam = N_PARAMS() 146 IF (nparam NE 2) THEN BEGIN 147 ras = report(['Incorrect number of arguments.' $ 148 + '!C' $ 149 + 'Usage : ' + usage]) 150 return, result 151 ENDIF 152 ; 153 @cm_4cal 120 154 ; test if ${PROJECT_OD} defined 121 155 CASE project_od_env OF … … 123 157 msg = 'eee : ${PROJECT_OD} is not defined' 124 158 ras = report(msg) 125 STOP159 return, result 126 160 END 127 161 ELSE: BEGIN … … 138 172 msg = 'eee : the directory' + iodirout + ' is not accessible.' 139 173 ras = report(msg) 140 STOP174 return, result 141 175 ENDIF 142 176 ; … … 145 179 msg = 'eee : the directory' + iodirout + ' was not found.' 146 180 ras = report(msg) 147 STOP 148 ENDIF 149 ; 150 da1=19880101 151 da2=20101231 181 return, result 182 ENDIF 152 183 ; 153 184 ; build data filename 154 filename='erai_ws_19890101_20091231_oafluxgrid.nc' 185 filename='erai_ws_' $ 186 + string(yyyymmddb,format='(i8.8)') $ 187 + '_' $ 188 + string(yyyymmdde,format='(i8.8)') $ 189 + '_oafluxgrid.nc' 155 190 ; 156 191 ; check if this file exists … … 161 196 msg = 'eee : the file ' + fullfilename + ' was not found.' 162 197 ras = report(msg) 163 STOP198 return, result 164 199 ENDIF 165 200 ; 166 201 ; build output filename 167 filename_out = 'TropFlux_ws_19890101_20091231.nc' 202 filename_out = 'TropFlux_ws_' $ 203 + string(yyyymmddb,format='(i8.8)') $ 204 + '_' $ 205 + string(yyyymmdde,format='(i8.8)') $ 206 + '.nc' 168 207 fullfilename_out = iodirout + filename_out 169 208 ; in order to avoid unexpected overwritten 170 IF ( FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN209 IF ((FILE_TEST(fullfilename_out) EQ 1) AND (project_overwrite EQ 0)) THEN BEGIN 171 210 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 172 211 ras = report(msg) 173 STOP212 return, result 174 213 ENDIF 175 214 ; 176 215 initncdf, fullfilename 177 u=read_ncdf('u10',da1,da2,file=fullfilename,/nostr) 178 v=read_ncdf('v10',da1,da2,file=fullfilename,/nostr) 216 u=read_ncdf('u10',yyyymmddb-.5d,yyyymmdde,file=fullfilename,/nostr) 217 timein=24.d*(time-julday(1,1,1957,0,0,0)) 218 jpt=n_elements(timein) 219 da=jul2date(time[0]) 220 cda0=string(da,format='(i8.8)') 221 da=jul2date(time[jpt-1]) 222 cda1=string(da,format='(i8.8)') 223 print, 'u10 in ws_correction_ncdf first date ', cda0 224 print, 'u10 in ws_correction_ncdf last date ' , cda1 225 ; 226 v=read_ncdf('v10',yyyymmddb-.5d,yyyymmdde,file=fullfilename,/nostr) 227 timein=24.d*(time-julday(1,1,1957,0,0,0)) 228 jpt=n_elements(timein) 229 da=jul2date(time[0]) 230 cda0=string(da,format='(i8.8)') 231 da=jul2date(time[jpt-1]) 232 cda1=string(da,format='(i8.8)') 233 print, 'v10 in ws_correction_ncdf first date ', cda0 234 print, 'v10 in ws_correction_ncdf last date ' , cda1 235 ; 179 236 w=sqrt(u*u+v*v) 180 237 ; … … 189 246 ; 190 247 for jt=0,jpt-1 do begin 191 jtt=(time (jt)-julday(1,1,yea(jt))) < 364192 q=reform(w_mean (*,*))193 w_m (*,*,jt)=q248 jtt=(time[jt]-julday(1,1,yea[jt])) < 364 249 q=reform(w_mean[*,*]) 250 w_m[*,*,jt]=q 194 251 endfor 195 252 help, w_m … … 211 268 ; 212 269 ;writing field 213 lat=reform(gphit(0,0:jpj-1)) 214 lon=reform(glamt(0:jpi-1,0)) 215 time=timegen(7670, start=julday(1,1,1989,0), units='days') 216 jpt=n_elements(time) 217 ; 218 cda0=string(jul2date(time(0)),format='(i8.8)') 219 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 220 ; 221 time=time-julday(1,1,1950) 222 jpt=n_elements(time) 270 lat=reform(gphit[0,0:jpj-1]) 271 lon=reform(glamt[0:jpi-1,0]) 223 272 ; 224 273 ncfile='!' + fullfilename_out … … 229 278 w_attr={units:'m/s',missing_value:1.e20,long_name:'mean wind speed',short_name:'w',axis:'TYX'} 230 279 ; 231 ncfields = 'ws[longitude,latitude, time]=w_new:w_attr; ' $280 ncfields = 'ws[longitude,latitude,*time]=w_new:w_attr; ' $ 232 281 + 'longitude[]=lon:lon_attr; ' $ 233 282 + 'latitude[]=lat:lat_attr; ' $ 234 + 'time[ *time]=time:time_attr ' $283 + 'time[]=timein:time_attr ' $ 235 284 + ' @ globattr' 236 285 ; 237 286 @ncdf_quickwrite 238 287 ; 288 result = 0 289 return, result 290 ; 239 291 end
Note: See TracChangeset
for help on using the changeset viewer.