- Timestamp:
- 11/30/11 15:53:12 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/basic_variable_evaluation_tpr_timeseries.pro
r106 r107 1 ;------------------------------------------------------------ 1 ;+ 2 ; 3 ; .. _basic_variable_evaluation_tpr_timeseries.pro: 4 ; 5 ; ============================================ 6 ; basic_variable_evaluation_tpr_timeseries.pro 7 ; ============================================ 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 12 ; SEE ALSO 13 ; ======== 14 ; 15 ; :ref:`project_profile.sh` 16 ; :ref:`project_init.pro` 17 ; :ref:`cm_project.pro` 18 ; 19 ; use :func:`read_basic_var`, :func:`x_site_location`, :func:`y_site_location` 20 ; 21 ; TODO 22 ; ==== 23 ; 24 ; make it work : missing extract_tpr_location.pro 25 ; 26 ; uncomment var parameter 27 ; 28 ; correct bad check on unavailable tpr data 29 ; 30 ; EXAMPLES 31 ; ======== 32 ; 33 ; :: 34 ; 35 ; IDL> date1 = 20000101L 36 ; IDL> date2 = 20091231L 37 ; IDL> basic_variable_evaluation_tpr_timeseries, date1, date2 38 ; 39 ; EVOLUTIONS 40 ; ========== 41 ; 42 ; $Id$ 43 ; 44 ; $URL$ 45 ; 46 ; - fplod 20111130T133857Z cratos (Linux) 47 ; 48 ; * try to make it work on my account on cratos 49 ; * remove x_site_location and x_site_location because already exist 50 ; 51 ;- 2 52 pro basic_variable_evaluation_tpr_timeseries, $ 3 53 ; var, $ ;; basic variable (sst, t2m, q2m, ws) to calculate the statistics 4 54 date1, $ ;; start date (in julian date. eg. 20000101) 5 55 date2 ;; end date (in julian date eg. 20091231) 6 7 56 @common 57 @cm_project 8 58 ;------------------------------------------------------------ 9 59 reinitplt, /z,/invert 10 60 key_portrait = 0 11 openps, FILENAME = 'idl.ps'61 openps, FILENAME = project_od_env+'basic_variable_evaluation_tpr_timeseries.ps' 12 62 ;------------------------------------------------------------ 13 63 ;; part to change … … 17 67 ;------------------------------------------------------------ 18 68 ;; Before running this program, you have to compile the following subroutines 19 ;; .r read_basic_var 69 ;; .r read_basic_var 20 70 21 71 ;; TPR locations. This needs to be updated with time since more locations are added to the array. … … 37 87 close,/all 38 88 39 fi ='/Users/pkb/work/MY_SAXO/TropFlux_update/basic_var_stat.txt'89 fi = project_id_env + 'basic_var_stat.txt' 40 90 openw,1,fi 41 91 … … 44 94 ;; First, this program reads the full TropFlux data and later extract it at specific TPR locations 45 95 46 file ="/Volumes/PAYASAM/TropFlux/TropFlux/sst_tropflux_1d_1989_2010.nc"96 file = project_id_env + "sst_tropflux_1d_1989_2010.nc" 47 97 initncdf, file 48 98 var=read_ncdf("sst", date1, date2, file=file,/nostr) … … 66 116 if (y ge 0. and y le 30.) then y=y+360. 67 117 dx=0.5 & dy=0.5 & box=[y-dy, y+dy, x-dx, x+dx] 68 118 69 119 read_basic_var, csite,date1,date2,nsmooth, $ 70 120 at, rh, sst, wu, wv, ws 71 121 help, sst 122 print, sst 72 123 ;; select the appropriate variables for evaluation (trp = sw or lw or sh or lh) 73 124 … … 89 140 cstat=string(cor, bias, std, rmsd, format='(f4.2,3x,f7.2,3x,f4.2,3x,f5.2)') 90 141 print, cstat 91 142 92 143 ;; PLOTTING THE TIME-SERIES 93 144 array=[tpr, var_tpr] & mi=min(array,/nan) & ma=max(array,/nan) & int=(ma-mi)/3. … … 103 154 104 155 close,/all 105 ;----------------------------------------------------------106 156 closeps 107 157 108 fig='basic_variable_evaluation_tpr_timeseries.ps'109 spawn, 'mv '+psdir+'idl.ps '+updatedir+fig110 spawn, 'gv '+updatedir+fig111 return112 158 end 113 ;--------------------------------------------------------------------------114 function x_site_location, site115 n1=strpos(site, 's')116 if (n1 gt -1) then begin117 ns=-1.118 x=strmid(site, 0, n1)119 x=float(x)*ns120 endif else begin121 n1=strpos(site, 'n')122 x=strmid(site, 0, n1)123 ny=1.124 x=float(x)*ny125 endelse126 return, float(x)127 end128 ;--------------------------------------------------------------------------129 function y_site_location, site130 n1=strpos(site, 'e')131 if (n1 gt -1) then begin132 n=strpos(site, 's')133 if (n gt -1) then begin134 y=strmid(site, n+1, n1-n-1)135 endif else begin136 n=strpos(site, 'n')137 y=strmid(site, n+1, n1-n-1)138 endelse139 140 endif else begin141 n1=strpos(site, 'w')142 n=strpos(site, 's')143 if (n gt -1) then begin144 y=strmid(site, n+1, n1-n-1)145 y=180+(180-float(y))146 endif else begin147 n=strpos(site, 'n')148 y=strmid(site, n+1, n1-n-1)149 y=180+(180-float(y))150 endelse151 endelse152 return,float(y)153 end154 155 ;--------------------------------------------------------------------------156 -
trunk/src/flux_evaluation_tpr_map.pro
r106 r107 1 ;------------------------------------------------------------ 1 ;+ 2 ; 3 ; .. _flux_evaluation_tpr_map.pro: 4 ; 5 ; =========================== 6 ; flux_evaluation_tpr_map.pro 7 ; =========================== 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 12 ; SEE ALSO 13 ; ======== 14 ; 15 ; :ref:`project_profile.sh` 16 ; :ref:`project_init.pro` 17 ; :ref:`cm_project.pro` 18 ; 19 ; TODO 20 ; ==== 21 ; 22 ; make it work : need output of flux_evaluation_tpr_timeseries.pro 23 ; 24 ; uncomment var 25 ; 26 ; coding rules 27 ; 28 ; EXAMPLES 29 ; ======== 30 ; 31 ; :: 32 ; 33 ; IDL> date1 = 20000101L 34 ; IDL> date2 = 20091231L 35 ; IDL> flux_evaluation_tpr_map, date1, date2 36 ; 37 ; EVOLUTIONS 38 ; ========== 39 ; 40 ; $Id$ 41 ; 42 ; $URL$ 43 ; 44 ; - fplod 20111130T142224Z cratos (Linux) 45 ; 46 ; * try to make it work on my account on cratos 47 ; * remove x_site_location and x_site_location because already exist 48 ; 49 ;- 2 50 pro flux_evaluation_tpr_map, $ 3 51 ; var, $ ;; flux variable (swr, lwr, lhf, shf) to calculate the statistics … … 6 54 7 55 @common 8 ;------------------------------------------------------------ 56 @cm_project 9 57 reinitplt, /z,/invert 10 58 key_portrait = 1 11 openps, FILENAME = 'idl.ps'12 ; ------------------------------------------------------------59 openps, FILENAME = project_od_env+'flux_evaluation_tpr_map.ps' 60 ; 13 61 ;; part to change 14 62 … … 21 69 rmsd_mi=0 & rmsd_ma=15 & rmsd_int=1.5 22 70 cor_mi=0.5 & cor_ma=1. & cor_int=0.025 23 24 ;------------------------------------------------------------25 71 26 72 ;; TPR locations. This needs to be updated with time since more locations are added to the array. … … 37 83 '21n23w', '4n23w', '4n38w', '6s10w', '8n38w', '8s30w'] 38 84 39 ;------------------------------------------------------------------------------------------------------------------------40 85 ;; This program will create the following text files with statistics of respective variables 41 ;------------------------------------------------------------------------------------------------------------------------ 86 42 87 close,/all 43 88 44 ;fi='/Users/pkb/work/MY_SAXO/TropFlux_update/flux_stat.txt'45 ;openw,1,fi46 ;printf,1, 'x y cor bias std ratio rmsd'47 ;------------------------------------------------------------------------------------------------------------------------48 89 erase 49 90 ;; PLOTING THE MAPS 50 91 51 fi ='/Users/pkb/work/MY_SAXO/TropFlux_update/flux_stat.txt'92 fi = project_od_env + 'flux_stat.txt' 52 93 res=read_ascii(fi,data_start=1) 53 94 ff=res.field1 … … 66 107 cstat=string(corr_t, bias_t, std_t, rmsd_t, format='(f4.2,3x,f7.2,3x,f4.2,3x,f5.2)') 67 108 68 file= '/Users/pkb/data/heat_budget/OAFLUX/mask_oaflux_30N30S.nc'109 file= project_id_env + 'mask_oaflux_30N30S.nc' 69 110 initncdf, file 70 111 domdef, 30,390,-30,30 … … 97 138 endfor 98 139 99 ;----------------------------------------------------------100 140 plt,msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,bias_mi, bias_ma, int=bias_int,/noer, marge=marge1, $ 101 141 title='2) Mean bias', subtitle='', small=[1,4,2],/rempl … … 122 162 plots, x,y,psym=8,symsize=1.5,color=0 123 163 endfor 124 ;----------------------------------------------------------125 164 plt,msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,rmsd_mi, rmsd_ma, int=rmsd_int,/noer, $ 126 165 title='3) RMSD ', subtitle='', small=[1,4,3],/rempl, marge=marge1 … … 146 185 plots, x,y,psym=8,symsize=1.5,color=0 147 186 endfor 148 ;----------------------------------------------------------149 187 plt,msk,realcont=2,/nocont,/nofill,xminor=1,yminor=1,lct=64,std_mi, std_ma, int=std_int,/noer, $ 150 188 title='4) STD ratio', subtitle='', small=[1,4,4],/rempl, marge=marge1 … … 173 211 174 212 erase 175 ;----------------------------------------------------------176 177 213 ;; computing the pdf 178 214 … … 195 231 xyouts, 0, -150, cstat, charsize=1.2 196 232 197 ;----------------------------------------------------------198 233 closeps 199 234 200 fig='flux_evaluation_tpr_map.ps'201 spawn, 'mv '+psdir+'idl.ps '+updatedir+fig202 spawn, 'gv '+updatedir+fig203 return204 235 end 205 ;--------------------------------------------------------------------------206 function x_site_location, site207 n1=strpos(site, 's')208 if (n1 gt -1) then begin209 ns=-1.210 x=strmid(site, 0, n1)211 x=float(x)*ns212 endif else begin213 n1=strpos(site, 'n')214 x=strmid(site, 0, n1)215 ny=1.216 x=float(x)*ny217 endelse218 return, float(x)219 end220 ;--------------------------------------------------------------------------221 function y_site_location, site222 n1=strpos(site, 'e')223 if (n1 gt -1) then begin224 n=strpos(site, 's')225 if (n gt -1) then begin226 y=strmid(site, n+1, n1-n-1)227 endif else begin228 n=strpos(site, 'n')229 y=strmid(site, n+1, n1-n-1)230 endelse231 232 endif else begin233 n1=strpos(site, 'w')234 n=strpos(site, 's')235 if (n gt -1) then begin236 y=strmid(site, n+1, n1-n-1)237 y=180+(180-float(y))238 endif else begin239 n=strpos(site, 'n')240 y=strmid(site, n+1, n1-n-1)241 y=180+(180-float(y))242 endelse243 endelse244 return,float(y)245 end246 247 ;--------------------------------------------------------------------------248 -
trunk/src/flux_evaluation_tpr_timeseries.pro
r106 r107 1 ;------------------------------------------------------------ 1 ;+ 2 ; 3 ; .. _flux_evaluation_tpr_timeseries.pro: 4 ; 5 ; ================================== 6 ; flux_evaluation_tpr_timeseries.pro 7 ; ================================== 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 12 ; SEE ALSO 13 ; ======== 14 ; 15 ; :ref:`project_profile.sh` 16 ; :ref:`project_init.pro` 17 ; :ref:`cm_project.pro` 18 ; 19 ; TODO 20 ; ==== 21 ; 22 ; make it work : missing READ_TPR_NETFLUX 23 ; 24 ; EXAMPLES 25 ; ======== 26 ; 27 ; :: 28 ; 29 ; IDL> date1 = 20000101L 30 ; IDL> date2 = 20091231L 31 ; IDL> flux_evaluation_tpr_timeseries, date1, date2 32 ; 33 ; EVOLUTIONS 34 ; ========== 35 ; 36 ; $Id$ 37 ; 38 ; $URL$ 39 ; 40 ; - fplod 20111130T141341Z cratos (Linux) 41 ; 42 ; * try to make it work on my account on cratos 43 ; * remove x_site_location and x_site_location because already exist 44 ; 45 ;- 2 46 pro flux_evaluation_tpr_timeseries, $ 3 47 ; var, $ ;; flux variable (swr, lwr, lhf, shf) to calculate the statistics … … 6 50 7 51 @common 8 ;------------------------------------------------------------ 52 @cm_project 9 53 reinitplt, /z,/invert 10 54 key_portrait = 0 11 openps, FILENAME = 'idl.ps'55 openps, FILENAME = project_od_env+'flux_evaluation_tpr_timeseries.ps' 12 56 ;------------------------------------------------------------ 13 57 ;; part to change … … 45 89 close,/all 46 90 47 fi= '/Users/pkb/work/MY_SAXO/TropFlux_update/flux_stat.txt'91 fi=project_id_env + 'flux_stat.txt' 48 92 openw,1,fi 49 93 … … 52 96 ;; First, this program reads the full TropFlux data and later extract it at specific TPR locations 53 97 54 file ="/Volumes/PAYASAM/TropFlux/TropFlux/shf_tropflux_1d_1989_2010.nc"98 file = project_id_env + "shf_tropflux_1d_1989_2010.nc" 55 99 initncdf, file 56 100 var=-1*read_ncdf("shf", date1, date2, file=file,/nostr) … … 74 118 if (y ge 0. and y le 30.) then y=y+360. 75 119 dx=0.5 & dy=0.5 & box=[y-dy, y+dy, x-dx, x+dx] 76 120 77 121 read_tpr_netflux, csite,date1,date2,nsmooth, $ 78 122 sw,lw,sh,lh … … 97 141 cstat=string(cor, bias, std, rmsd, format='(f4.2,3x,f7.2,3x,f4.2,3x,f5.2)') 98 142 print, cstat 99 143 100 144 ;; PLOTTING THE TIME-SERIES 101 145 array=[tpr, var_tpr] & mi=min(array,/nan) & ma=max(array,/nan) & int=(ma-mi)/3. … … 111 155 112 156 close,/all 113 ;----------------------------------------------------------114 157 closeps 115 158 116 fig='flux_evaluation_tpr_timeseries.ps'117 spawn, 'mv '+psdir+'idl.ps '+updatedir+fig118 spawn, 'gv '+updatedir+fig119 return120 159 end 121 ;--------------------------------------------------------------------------122 function x_site_location, site123 n1=strpos(site, 's')124 if (n1 gt -1) then begin125 ns=-1.126 x=strmid(site, 0, n1)127 x=float(x)*ns128 endif else begin129 n1=strpos(site, 'n')130 x=strmid(site, 0, n1)131 ny=1.132 x=float(x)*ny133 endelse134 return, float(x)135 end136 ;--------------------------------------------------------------------------137 function y_site_location, site138 n1=strpos(site, 'e')139 if (n1 gt -1) then begin140 n=strpos(site, 's')141 if (n gt -1) then begin142 y=strmid(site, n+1, n1-n-1)143 endif else begin144 n=strpos(site, 'n')145 y=strmid(site, n+1, n1-n-1)146 endelse147 148 endif else begin149 n1=strpos(site, 'w')150 n=strpos(site, 's')151 if (n gt -1) then begin152 y=strmid(site, n+1, n1-n-1)153 y=180+(180-float(y))154 endif else begin155 n=strpos(site, 'n')156 y=strmid(site, n+1, n1-n-1)157 y=180+(180-float(y))158 endelse159 endelse160 return,float(y)161 end162 163 ;--------------------------------------------------------------------------164 -
trunk/src/read_basic_var.pro
r106 r107 1 ;------------------------------------------------------------------------------------------------- 1 ;+ 2 ; 3 ; .. _read_basic_var.pro: 4 ; 5 ; ================== 6 ; read_basic_var.pro 7 ; ================== 8 ; 9 ; DESCRIPTION 10 ; =========== 11 ; 12 ; SEE ALSO 13 ; ======== 14 ; 15 ; :ref:`project_profile.sh` 16 ; 17 ; called by :ref:`basic_variable_evaluation_tpr_timeseries.pro` 18 ; 19 ; TODO 20 ; ==== 21 ; 22 ; supprimer ./paper01/fig3/read_basic_var.pro 23 ; car ce module a l'air d'être le même 24 ; 25 ; make it work 26 ; 27 ; coding rules 28 ; 29 ; EVOLUTIONS 30 ; ========== 31 ; 32 ; $Id$ 33 ; 34 ; $URL$ 35 ; 36 ; - fplod 20111130T133857Z cratos (Linux) 37 ; 38 ; * try to make it work on my account on cratos 39 ; 40 ;- 2 41 pro read_basic_var, csite,date1,date2,nsmooth, $ 3 42 at, rh, sst, wu, wv, ws 4 43 5 ;6 ;-------------------------------------------------------------------------------------------------7 44 @common 8 9 ;dir='/Volumes/Iomega_HDD/work/flux_reconstruction/mooriing_all/' 10 dir="/Volumes/PAYASAM/mooriing_all/" 11 ; 45 @cm_project 46 12 47 ;; DEFINE THE OUTPUT TIME AXIS 13 48 ; … … 25 60 26 61 ;;SHORTWAVE 27 fi= dir+'rad'+csite+'_dy.cdf'62 fi=project_id_env+'rad'+csite+'_dy.cdf' 28 63 f=file_test(fi) 29 64 sw=fltarr(jpt)+!values.f_nan … … 45 80 46 81 ;;LHF 47 fi= dir+'qlat'+csite+'_dy.cdf'82 fi=project_id_env+'qlat'+csite+'_dy.cdf' 48 83 f=file_test(fi) 49 84 lh=fltarr(jpt)+!values.f_nan … … 62 97 63 98 ;;POSITION 64 fi= dir+'pos'+csite+'_dy.cdf'99 fi=project_id_env+'pos'+csite+'_dy.cdf' 65 100 f=file_test(fi) 66 101 lat=fltarr(jpt)+!values.f_nan … … 76 111 lon(tt0(ind))=lon0(ind) 77 112 endif 78 endif 113 endif 79 114 80 115 81 116 ;;MET PARAMETERS 82 fi= dir+'met'+csite+'_dy.cdf'117 fi=project_id_env+'met'+csite+'_dy.cdf' 83 118 f=file_test(fi) 84 119 wu=fltarr(jpt)+!values.f_nan … … 123 158 ind_at=where(at_q ne 1 and at_q ne 2) & ind_ws=where(ws_q ne 1 and ws_q ne 2) 124 159 ind_rh=where(rh_q ne 1 and rh_q ne 2) & ind_sst=where(sst_q ne 1 and sst_q ne 2) 125 ind_lh=where(lh_q ne 1 and lh_q ne 2) 126 160 ind_lh=where(lh_q ne 1 and lh_q ne 2) 161 127 162 ind=union(ind_at, union(ind_rh, union(ind_ws, union(ind_lh, ind_sst)))) 128 163 … … 136 171 ;; Replace missing values by "NaN" 137 172 ; 138 tsvars=['at','sw','rh','sst','wu','wv','ws','lat','lon'] 173 tsvars=['at','sw','rh','sst','wu','wv','ws','lat','lon'] 139 174 vars=[tsvars] 140 175 nn=n_elements(vars) … … 151 186 ws=smooth(ws,nsmooth,/nan) & sw=smooth(sw,nsmooth,/nan) 152 187 153 ;-------------------------------------------------------------------------------------------------154 188 end 155 ;------------------------------------------------------------------------------------------------- 156 157 158 ;------------------------------------------------------------------------------------------------- 189 159 190 function time_lec, fi 160 191 tt=ncdf_lec(fi,var='time') … … 168 199 return, tt 169 200 end 170 171 ;-------------------------------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.