Changeset 310
- Timestamp:
- May 1, 2009 5:03:13 PM (16 years ago)
- Location:
- palm/trunk/SCRIPTS/NCL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/NCL/timeseries.ncl
r250 r310 139 139 140 140 vNam=getfilevarnames(f_att) 141 vNam_static=vNam 141 142 142 143 print(" ") … … 147 148 if (dim .EQ. 0) then 148 149 print(" ") 149 print("There areno data on file")150 print("There is no data on file") 150 151 print(" ") 151 152 end if 152 153 153 t_all = f[:]->time154 nt = dimsizes(t_all)155 delta_t =t_all(nt-1)/nt154 t_all = f[:]->time 155 nt = dimsizes(t_all) 156 delta_t = t_all(nt-1)/nt 156 157 157 158 ;**************************************************** … … 344 345 end if 345 346 346 count_var=0 347 do varn = dim-1,0,1 347 348 if (var .NE. "all") then 349 vNam_temp = new((/dim/),string) 350 comma = 0 351 var_char = stringtocharacter(var) 352 no_char = dimsizes(var_char) 353 354 do j = 0, no_char-1 355 if(var_char(j) .eq. ",") 356 comma = comma + 1 357 end if 358 end do 359 360 indices = new((/comma/), integer) 361 comma = 0 362 363 do j = 0, no_char-1 364 if(var_char(j) .eq. ",") 365 indices(comma) = j 366 comma = comma + 1 367 end if 368 end do 369 370 do j = 0, comma -2 371 vNam_temp(j) = charactertostring(var_char(indices(j)+1:indices(j+1)-1)) 372 end do 373 374 delete(vNam) 375 vNam = new((/comma-1/),string) 376 do varn = 0, comma - 2 377 vNam(varn) = vNam_temp(comma - 2 - varn) 378 end do 379 380 do j = 0, comma-2 381 count_check = 0 382 do varn = 0, dim-1 383 if(vNam(j) .ne. vNam_static(varn)) 384 count_check=count_check+1 385 end if 386 end do 387 388 if(count_check .eq. dim) 389 print(" ") 390 print("The variables 'var="+var+"'" ) 391 print("do not exist on your input file;") 392 print("be sure to have one comma before and after each variable") 393 print(" ") 394 exit 395 end if 396 end do 397 398 dim = comma-1 399 end if 400 401 402 do varn = dim-1, 0, 1 348 403 349 404 if( isStrSubset (vNam(varn), "time") ) … … 351 406 else 352 407 check = True 353 end if 354 355 if (var .NE. "all") then 356 check = isStrSubset( var,","+vNam(varn)+"," ) 357 end if 358 408 end if 359 409 360 410 if(check) then 361 count_var=count_var+1362 411 363 412 data_all = f[:]->$vNam(varn)$ 364 413 data_att = f_att->$vNam(varn)$ 365 414 unit(varn) = data_att@units 366 415 416 367 417 data(varn,:)=data_all(start_time_step:end_time_step) 368 418 … … 508 558 end if 509 559 end do 510 511 if (count_var .EQ. 0)then512 print(" ") 513 print(" The variables 'var="+var+"' do not exist on your input file;")514 print(" be sure to have one comma berfore and after each variable")515 print(" ") 516 exit560 561 if (isStrSubset(data@long_name," SR " ))then 562 print(" ") 563 print("If you have outputs of statistic regions you cannot overlay variables;") 564 print("'over' is set to 0" ) 565 print(" ") 566 over = 0 517 567 end if 518 568 519 do varn = dim-1, 0,1569 do varn = dim-1, 0, 1 520 570 521 571 if( isStrSubset (vNam(varn), "time") ) … … 530 580 531 581 if(check) then 532 533 if (isStrSubset(vNam(varn),"_0 " ))then 534 print(" ") 535 print("If you have Outputs of statistic regions you cannot overlay variables; 'over' is set to 0") 536 print(" ") 537 over = 0 538 end if 539 582 540 583 if (over .EQ. 1) then 541 584 … … 557 600 res@xyLineLabelFontHeightF = 0.05 558 601 res@xyLineLabelFontColor = 237 559 res@trYMaxF = m inE560 res@trYMinF = m axE602 res@trYMaxF = maxE 603 res@trYMinF = minE 561 604 plot_E = gsn_csm_xy(wks_ps,t,data(varn,:),res) 562 605 end if … … 574 617 res@xyLineLabelFontHeightF = 0.05 575 618 res@xyLineLabelFontColor = 237 576 res@trYMaxF = m inus577 res@trYMinF = m axus619 res@trYMaxF = maxus 620 res@trYMinF = minus 578 621 plot_us = gsn_csm_xy(wks_ps,t,data(varn,:),res) 579 622 end if … … 591 634 res@xyLineLabelFontHeightF = 0.05 592 635 res@xyLineLabelFontColor = 237 593 res@trYMaxF = m inu594 res@trYMinF = m axu636 res@trYMaxF = maxu 637 res@trYMinF = minu 595 638 plot_umax = gsn_csm_xy(wks_ps,t,data(varn,:),res) 596 639 end if … … 615 658 res@xyLineLabelFontHeightF = 0.05 616 659 res@xyLineLabelFontColor = 237 617 res@trYMaxF = m inz618 res@trYMinF = m axz660 res@trYMaxF = maxz 661 res@trYMinF = minz 619 662 plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res) 620 663 end if … … 632 675 res@xyLineLabelFontHeightF = 0.05 633 676 res@xyLineLabelFontColor = 237 634 res@trYMaxF = m inw635 res@trYMinF = m axw677 res@trYMaxF = maxw 678 res@trYMinF = minw 636 679 plot_wpptp0 = gsn_csm_xy(wks_ps,t,data(varn,:),res) 637 680 end if … … 656 699 res@xyLineLabelFontHeightF = 0.05 657 700 res@xyLineLabelFontColor = 237 658 res@trYMaxF = m inp659 res@trYMinF = m axp701 res@trYMaxF = maxp 702 res@trYMinF = minp 660 703 plot_pt_0_ = gsn_csm_xy(wks_ps,t,data(varn,:),res) 661 704 end if … … 673 716 res@xyLineLabelFontHeightF = 0.05 674 717 res@xyLineLabelFontColor = 237 675 res@trYMaxF = m ins676 res@trYMinF = m axs718 res@trYMaxF = maxs 719 res@trYMinF = mins 677 720 plot_splptx = gsn_csm_xy(wks_ps,t,data(varn,:),res) 678 721 end if … … 695 738 end if 696 739 end do 740 741 742 do varn = dim-1, 0, 1 697 743 698 do varn = dim-1,0,1699 700 744 if( isStrSubset (vNam(varn), "time") ) 701 745 check = False … … 819 863 overlay(plot_umax,plot_vmax) 820 864 overlay(plot_umax,plot_wmax) 865 821 866 n=n+1 822 867 plot_ps(n) = plot_umax … … 1177 1222 res@gsnLeftString = vNam(varn) 1178 1223 res@gsnRightString = unit(varn) 1179 res@trYMaxF = m in(data(varn,:))1180 res@trYMinF = m ax(data(varn,:))1224 res@trYMaxF = max(data(varn,:)) 1225 res@trYMinF = min(data(varn,:)) 1181 1226 if (min(data(varn,:)) .EQ. max(data(varn,:))) then 1182 1227 if (min(data(varn,:)) .EQ. 0)then 1183 res@trYMaxF = m in(data(varn,:))-0.11184 res@trYMinF = m ax(data(varn,:))+0.11228 res@trYMaxF = max(data(varn,:))-0.1 1229 res@trYMinF = min(data(varn,:))+0.1 1185 1230 end if 1186 1231 if (min(data(varn,:)) .LT. 0)then 1187 res@trYMaxF = m in(data(varn,:))+(min(data(varn,:)))/21188 res@trYMinF = m ax(data(varn,:))-(max(data(varn,:)))/21232 res@trYMaxF = max(data(varn,:))+(min(data(varn,:)))/2 1233 res@trYMinF = min(data(varn,:))-(max(data(varn,:)))/2 1189 1234 end if 1190 1235 if (min(data(varn,:)) .GT. 0)then 1191 res@trYMaxF = m in(data(varn,:))-(min(data(varn,:)))/21192 res@trYMinF = m ax(data(varn,:))+(max(data(varn,:)))/21236 res@trYMaxF = max(data(varn,:))-(min(data(varn,:)))/2 1237 res@trYMinF = min(data(varn,:))+(max(data(varn,:)))/2 1193 1238 end if 1194 1239 end if 1195 1240 plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res) 1196 1241 end if 1242 1243 ; *************************************************** 1244 ; transparent legend as placeholder for single plots 1245 ; *************************************************** 1246 lgresmono = True 1247 lgMonoDashIndex = False 1248 lgresmono@lgMonoLineColor = True 1249 lgresmono@lgLabelFont = "helvetica" 1250 lgresmono@lgLabelFontHeightF = .1 1251 lgresmono@vpWidthF = 0.4 1252 lgresmono@vpHeightF = 0.4 1253 lgresmono@lgLineColor = 0 1254 lgresmono@lgPerimOn = False 1255 lbid = gsn_create_legend(wks_ps,1,(/""/),lgresmono) 1256 1257 amres = True 1258 amres@amParallelPosF = 0.6 1259 amres@amOrthogonalPosF = -0.2 1260 annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres) 1197 1261 1198 1262 else … … 1204 1268 res@gsnLeftString = vNam(varn) 1205 1269 res@gsnRightString = unit(varn) 1270 1206 1271 if (norm_t .NE. 1.)then 1207 1272 res@tiXAxisString = "t ["+unit_t+"]" … … 1215 1280 res@tmXBLabelFontHeightF = font_size 1216 1281 res@tmYLLabelFontHeightF = font_size 1217 res@trYMaxF = m in(data(varn,:))1218 res@trYMinF = m ax(data(varn,:))1282 res@trYMaxF = max(data(varn,:)) 1283 res@trYMinF = min(data(varn,:)) 1219 1284 if (min(data(varn,:)) .EQ. max(data(varn,:))) then 1220 1285 if (min(data(varn,:)) .EQ. 0)then 1221 res@trYMaxF = m in(data(varn,:))-0.11222 res@trYMinF = m ax(data(varn,:))+0.11286 res@trYMaxF = max(data(varn,:))-0.1 1287 res@trYMinF = min(data(varn,:))+0.1 1223 1288 end if 1224 1289 if (min(data(varn,:)) .LT. 0)then 1225 res@trYMaxF = m in(data(varn,:))+(min(data(varn,:)))/21226 res@trYMinF = m ax(data(varn,:))-(max(data(varn,:)))/21290 res@trYMaxF = max(data(varn,:))+(min(data(varn,:)))/2 1291 res@trYMinF = min(data(varn,:))-(max(data(varn,:)))/2 1227 1292 end if 1228 1293 if (min(data(varn,:)) .GT. 0)then 1229 res@trYMaxF = m in(data(varn,:))-(min(data(varn,:)))/21230 res@trYMinF = m ax(data(varn,:))+(max(data(varn,:)))/21294 res@trYMaxF = max(data(varn,:))-(min(data(varn,:)))/2 1295 res@trYMinF = min(data(varn,:))+(max(data(varn,:)))/2 1231 1296 end if 1232 1297 end if
Note: See TracChangeset
for help on using the changeset viewer.