Ignore:
Timestamp:
Apr 11, 2008 10:54:53 AM (16 years ago)
Author:
letzel
Message:
  • NCL scripts in trunk/SCRIPTS/NCL updated for vector plots
File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/NCL/cross_sections.ncl

    r157 r161  
    1212
    1313   if (isfilepresent("~/.ncl_preferences")) then
    14       parameter = asciiread("~/.ncl_preferences",73,"string")
     14      parameter = asciiread("~/.ncl_preferences",75,"string")
    1515      delete(parameter@_FillValue)
    1616   else
     
    208208   print(" ")
    209209   dim   = dimsizes(vNam)
    210  
     210   if (dim .EQ. 0) then
     211      print(" ")
     212      print("There are no data on file")
     213      print(" ")
     214   end if
     215
    211216   ; ***************************************************
    212217   ; set up recourses
     
    259264   end if
    260265
    261    ; ***************************************************
    262    ; open workstation(s)
    263    ; ***************************************************
    264 
    265    wks_ps  = gsn_open_wks(format_out,file_out)
    266    gsn_define_colormap(wks_ps,"rainbow+white")
    267 
    268    plot=new((/no_columns*no_lines/),graphic)
    269 
    270    page = 0
    271 
    272    nc1 = no_columns
    273    nl1 = no_lines
    274 
    275    print("plots sorted by '"+sort+"'")
    276    print(" ")
    277 
    278266   ; *********************************************
    279267   ; set up of start_time_step and end_time_step
    280268   ; *********************************************
    281269
    282    t = f->time
     270   t    = f->time
    283271   nt = dimsizes(t)
    284272     
     
    288276
    289277   if ( .not. isvar("start_time_step") ) then           
    290       start_time_step = 1
     278      start_time_step = 0
    291279      if (parameter(13) .NE. "1") then
    292          if (parameter(13) .LE. "0")
     280         if (parameter(13) .LT. "1")
    293281            print(" ")
    294282            print("Begin with time step 1")
     
    302290            exit
    303291         end if
    304          start_time_step = stringtointeger(parameter(13)) 
     292         start_time_step = stringtointeger(parameter(13))-1 
    305293      end if
    306294   else
     
    317305         exit
    318306      end if
     307      start_time_step = start_time_step - 1
    319308   end if
    320309
     
    324313
    325314   if ( .not. isvar("end_time_step") ) then             
    326       end_time_step = nt
     315      end_time_step = nt-1
    327316      if (parameter(15) .NE. "nt") then
    328317         if (parameter(15) .LE. "0")
     
    344333            exit
    345334         end if
    346          end_time_step = stringtointeger(parameter(15)) 
     335         end_time_step = stringtointeger(parameter(15))-1 
    347336      end if   
    348337   else
     
    365354         exit
    366355      end if
    367    end if
     356      end_time_step = end_time_step-1
     357   end if
     358
     359   no_time=(end_time_step-start_time_step)+1
    368360
    369361   ; ****************************************************
     
    374366      if ( .not. isvar("plotvec") ) then
    375367         plotvec = parameter(69)
    376          if (parameter(69) .EQ. "plotvec") then
    377             print(" ")
    378             print("Please indicate the variable where the vector plot shall overlay ('plotvec')")
    379             print(" ")
    380             exit
    381          end if
    382368      end if
    383369      if ( .not. isvar("vec1") ) then
     
    409395   ; ****************************************************
    410396
    411    do varn=0,dim-
    412 
    413       if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
     397   do varn=dim-1,0,
     398
     399      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" .or. vNam(varn) .eq. "zu" .or. vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi" .or. vNam(varn) .eq. "time" .or. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d" .or. vNam(varn) .eq. "x" .or. vNam(varn) .eq. "y" .or. vNam(varn) .eq. "zu_xy" .or. vNam(varn) .eq. "zw_xy" .or. vNam(varn) .eq. "zu1_xy" .or. vNam(varn) .eq. "ind_z_xy" .or. vNam(varn) .eq. "y_xz" .or. vNam(varn) .eq. "yv_xz" .or. vNam(varn) .eq. "ind_y_xz" .or. vNam(varn) .eq. "x_yz" .or. vNam(varn) .eq. "xu_yz" .or. vNam(varn) .eq. "ind_x_yz") then
    414400         check = False
    415       end if
    416       if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
    417          check = False
    418       end if     
     401      else
     402         check = True
     403      end if   
    419404      if (  isvar("var") ) then 
    420          check = isStrSubset( var,vNam(varn)+",")
     405         check = isStrSubset( var,","+vNam(varn)+",")
    421406      end if
    422407      if (parameter(21) .NE. "variables") then
    423408         var = parameter(21)
    424          check = isStrSubset( var,vNam(varn)+"," )
     409         check = isStrSubset( var,","+vNam(varn)+"," )
    425410      end if   
    426411
    427412      if(check) then
    428        
     413         print(vNam(varn))
    429414         data_all = f->$vNam(varn)$
    430415
     
    536521   end do
    537522
     523   if (xyc .EQ. 1) then
     524      no_layer = (ze-zs)+1
     525   end if
     526   if (xzc .EQ. 1) then
     527      no_layer = (ye-ys)+1
     528   end if
     529   if (yzc .EQ. 1) then
     530      no_layer = (xe-xs)+1
     531   end if
     532
    538533   data  = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,(xe-xs)+1/),float)
    539534
     
    570565   v1=0
    571566   v2=0
    572 
    573    do varn=0,dim-1 
     567   no_var=0
     568   n=0
     569
     570   do varn=dim-1,0,1 
    574571     
    575572      data_all = f->$vNam(varn)$
    576573
    577574      if (vector .EQ. 1) then   
    578          check_vec1 = isStrSubset( vec1,vNam(varn)+",")
    579          check_vec2 = isStrSubset( vec2,vNam(varn)+",")
     575         check_vec1 = isStrSubset( vec1,","+vNam(varn)+",")
     576         check_vec2 = isStrSubset( vec2,","+vNam(varn)+",")
    580577      end if
    581578           
    582       if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
     579      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" .or. vNam(varn) .eq. "zu" .or. vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi" .or. vNam(varn) .eq. "time" .or. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d" .or. vNam(varn) .eq. "x".or. vNam(varn) .eq. "y" .or. vNam(varn) .eq. "zu_xy" .or. vNam(varn) .eq. "zw_xy" .or. vNam(varn) .eq. "zu1_xy" .or. vNam(varn) .eq. "ind_z_xy" .or. vNam(varn) .eq. "y_xz" .or. vNam(varn) .eq. "yv_xz" .or. vNam(varn) .eq. "ind_y_xz" .or. vNam(varn) .eq. "x_yz" .or. vNam(varn) .eq. "xu_yz" .or. vNam(varn) .eq. "ind_x_yz") then
    583580         check = False
    584       end if
    585       if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
    586          check = False
    587       end if     
     581      else
     582         check = True
     583      end if 
    588584      if (  isvar("var") ) then 
    589          check = isStrSubset( var,vNam(varn)+",")
    590       end if
    591  
     585         check = isStrSubset( var,","+vNam(varn)+",")
     586      end if 
    592587      if (parameter(21) .NE. "variables") then
    593588         var = parameter(21)
    594          check = isStrSubset( var,vNam(varn)+"," )
     589         check = isStrSubset( var,","+vNam(varn)+"," )
    595590      end if 
    596591
    597592      if(check) then
    598593
     594         no_var=no_var+1
     595
    599596         if (vector .EQ. 1) then
    600             if (vNam(varn)+"," .EQ. vec1) then
     597            if (","+vNam(varn)+"," .EQ. vec1) then
    601598               v1=v1+1
    602599            end if
    603             if (vNam(varn)+"," .EQ. vec2) then
     600            if (","+vNam(varn)+"," .EQ. vec2) then
    604601               v2=v2+1
    605602            end if
     
    608605         data(varn,:,:,:,:)=data_all(0:nt-1,zs:ze,ys:ye,xs:xe)
    609606         if (check_vec1) then
    610             print("in vec1")
    611607            vect1=data_all
    612608         end if
    613609         if (check_vec2) then
    614              print("in vec2")
    615610            vect2=data_all
    616611         end if
     
    626621      delete(data_all)
    627622
    628    end do 
     623   end do
     624 
     625   plot_panel=new((/no_time*no_layer*no_var/),graphic)
    629626
    630627   if (vector .EQ. 1) then
     
    645642
    646643   ; ***************************************************
     644   ; open workstation(s)
     645   ; ***************************************************
     646
     647   wks_ps  = gsn_open_wks(format_out,file_out)
     648   gsn_define_colormap(wks_ps,"rainbow+white")
     649
     650   plot=new((/no_time*no_layer*no_var/),graphic)
     651
     652   page = 0
     653   n=0
     654
     655   print("plots sorted by '"+sort+"'")
     656   print(" ")
     657
     658   ; ***************************************************
    647659   ; create plots
    648660   ; ***************************************************
     
    650662   check = True
    651663
    652    do varn=0,dim-1
     664   do varn=dim-1,0,1
    653665
    654666      if (vector .EQ. 1) then   
    655          check_vecp = isStrSubset( plotvec,vNam(varn)+",")
     667         check_vecp = isStrSubset( plotvec,","+vNam(varn)+",")
    656668      end if
    657669
    658       if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
    659          check = False
    660       end if
    661       if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
    662          check = False
    663       end if     
     670      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" .or. vNam(varn) .eq. "zu" .or. vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi" .or. vNam(varn) .eq. "time" .or. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d" .or. vNam(varn) .eq. "x".or. vNam(varn) .eq. "y" .or. vNam(varn) .eq. "zu_xy" .or. vNam(varn) .eq. "zw_xy" .or. vNam(varn) .eq. "zu1_xy" .or. vNam(varn) .eq. "ind_z_xy" .or. vNam(varn) .eq. "y_xz" .or. vNam(varn) .eq. "yv_xz" .or. vNam(varn) .eq. "ind_y_xz" .or. vNam(varn) .eq. "x_yz" .or. vNam(varn) .eq. "xu_yz" .or. vNam(varn) .eq. "ind_x_yz") then
     671         check = False
     672      else
     673         check = True
     674      end if   
    664675      if (  isvar("var") ) then 
    665          check = isStrSubset( var,vNam(varn)+",")
     676         check = isStrSubset( var,","+vNam(varn)+",")
    666677      end if
    667678      if (parameter(21) .NE. "variables") then
    668679         var = parameter(21)
    669          check = isStrSubset( var,vNam(varn)+"," )
     680         check = isStrSubset( var,","+vNam(varn)+"," )
    670681      end if
    671682   
    672683      if(check) then
    673      
     684   
    674685         ; ****************************************************
    675686         ; loops over time and layer
    676687         ; ****************************************************
    677688
    678          do lo = los, loe                                       ; lo: loop outer
    679             do li = lis, lie, no_lines*no_columns               ; li: loop inner
    680                
    681                if ( sort .eq. "time" ) then
    682                   ta = li
    683                   tb = min( (/li + no_lines*no_columns - 1, end_time_step/) )
    684                   if ( xyc .eq. 1 ) then
    685                      xa = xs
    686                      xb = xe
    687                      ya = ys
    688                      yb = ye
    689                      za = lo
    690                      zb = lo
    691                   end if
    692                   if ( xzc .eq. 1 ) then
    693                      xa = xs
    694                      xb = xe
    695                      ya = lo
    696                      yb = lo
    697                      za = zs
    698                      zb = ze
    699                   end if
    700                   if ( yzc .eq. 1 ) then
    701                      xa = lo
    702                      xb = lo
    703                      ya = ys
    704                      yb = ye
    705                      za = zs
    706                      zb = ze
    707                   end if
    708                end if
    709 
    710                if ( sort .eq. "layer" ) then
    711                   ta = lo
    712                   tb = lo
    713                   if ( xyc .eq. 1 ) then
    714                      xa = xs
    715                      xb = xe
    716                      ya = ys
    717                      yb = ye
    718                      za = li
    719                      zb = min( (/li + no_lines*no_columns - 1, ze/) ) 
    720                   end if
    721                   if ( xzc .eq. 1 ) then
    722                      xa = xs
    723                      xb = xe
    724                      ya = li
    725                      yb = min( (/li + no_lines*no_columns - 1, ye/) )
    726                      za = zs
    727                      zb = ze
    728                   end if
    729                   if ( yzc .eq. 1 ) then
    730                      xa = li
    731                      xb = min( (/li + no_lines*no_columns - 1, xe/) )
    732                      ya = ys
    733                      yb = ye
    734                      za = zs
    735                      zb = ze
    736                   end if
    737                end if   
    738 
     689         do lo = los, loe                                       
     690            do li = lis, lie                           
     691                 
    739692               ; ****************************************************
    740693               ; xy cross section
     
    743696               if ( xyc .eq. 1 ) then
    744697               
    745                   cs_res@tiXAxisString   = "x [m]"
    746                   cs_res@tiYAxisString   = "y [m]"
     698                  cs_res@tiXAxisString = "x [m]"
     699                  cs_res@tiYAxisString = "y [m]"
    747700                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
    748                  
     701     
    749702                  if ( sort .eq. "time" ) then
    750703                     if ( data&z(lo) .eq. -1 ) then
     
    753706                        level = "=" + data&z(lo) + "m"
    754707                     end if
    755                      do n = 0,tb-ta
    756                         cs_res@gsnCenterString = "time=" + data&t(li+n-1) +"s  z"+level
    757                         plot1 = gsn_csm_contour(wks_ps,data(varn,li+n-1,lo,:,:),cs_res) 
     708                     cs_res@gsnCenterString = "time=" + data&t(li) +"s  z"+level
     709                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,lo,:,:),cs_res)
     710                     if (vector .EQ. 1) then
    758711                        if (check_vecp)
    759712                           vecres                  = True            ; vector only resources
    760713                           vecres@gsnDraw          = False           ; don't draw
    761                            vecres@gsnFrame         = False           ; don't advance frame
    762                            vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
    763                            vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
    764                            vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     714                           vecres@gsnFrame         = False           ; don't advance frame
     715                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     716                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     717                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
    765718                           vecres@gsnRightString   = " "             ; turn off right string
    766719                           vecres@gsnLeftString    = " "             ; turn off left string
    767720                           vecres@tiXAxisString    = " "   
    768                            plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
    769                            overlay(plot1, plot_vec)
    770                         end if                     
    771                         plot(n) = plot1                         
    772                      end do
     721                           plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     722                           overlay(plot(n), plot_vec)
     723                        else 
     724                           vecres                  = True            ; vector only resources
     725                           vecres@gsnDraw          = False           ; don't draw
     726                           vecres@gsnFrame         = False           ; don't advance frame
     727                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     728                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     729                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     730                           vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
     731                           vecres@gsnLeftString    = " "             ; turn off left string
     732                           vecres@tiXAxisString    = " "   
     733                           plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     734                           plot(n) = plot_vec
     735                        end if
     736                     end if                         
    773737                  end if
    774738
    775739                  if ( sort .eq. "layer" ) then
    776                      do n = 0, zb-za
    777                         if ( data&z(li+n) .eq. -1 ) then
    778                            level = "-average"
    779                         else
    780                            level = "=" + data&z(li+n) + "m"
     740                     if ( data&z(li) .eq. -1 ) then
     741                        level = "-average"
     742                     else
     743                        level = "=" + data&z(li) + "m"
     744                     end if
     745                     cs_res@gsnCenterString = "t=" + data&t(lo) + "s  z"+ level
     746                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,li,:,:),cs_res)
     747                     if (vector .EQ. 1) then
     748                        if (check_vecp)
     749                           vecres                  = True            ; vector only resources
     750                           vecres@gsnDraw          = False           ; don't draw
     751                           vecres@gsnFrame         = False           ; don't advance frame
     752                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     753                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     754                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     755                           vecres@gsnRightString   = " "             ; turn off right string
     756                           vecres@gsnLeftString    = " "             ; turn off left string
     757                           vecres@tiXAxisString    = " "   
     758                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     759                           overlay(plot(n), plot_vec)
     760                        else 
     761                           vecres                  = True            ; vector only resources
     762                           vecres@gsnDraw          = False           ; don't draw
     763                           vecres@gsnFrame         = False           ; don't advance frame
     764                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     765                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     766                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     767                           vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
     768                           vecres@gsnLeftString    = " "             ; turn off left string
     769                           vecres@tiXAxisString    = " "   
     770                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     771                           plot(n) = plot_vec
    781772                        end if
    782                         cs_res@gsnCenterString = "t=" + data&t(lo-1) + "s  z"+ level
    783                         plot1 = gsn_csm_contour(wks_ps,data(varn,lo-1,li+n,:,:),cs_res)
    784                         if (check_vecp)
    785                            vecres                  = True            ; vector only resources
    786                            vecres@gsnDraw          = False           ; don't draw
    787                            vecres@gsnFrame         = False           ; don't advance frame
    788                            vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
    789                            vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
    790                            vecres@vcRefLengthF     = 0.05            ; define length of vec ref
    791                            vecres@gsnRightString   = " "             ; turn off right string
    792                            vecres@gsnLeftString    = " "             ; turn off left string
    793                            vecres@tiXAxisString    = " "   
    794                            plot_vec=gsn_csm_vector(wks_ps,vect1(lo-1,li+n,:,:),vect2(lo-1,li+n,:,:),vecres)
    795                            overlay(plot1, plot_vec)
    796                         end if
    797                         plot(n) = plot1
    798                      end do
     773                     end if
    799774                  end if
    800 
    801775               end if
    802776
     
    817791                        level = "=" + data&y(lo) + "m"
    818792                     end if
    819                      do n = 0, tb-ta
    820                         cs_res@gsnCenterString = "t=" + data&t(li+n-1) + "s  y"+ level
    821                         plot1 = gsn_csm_contour(wks_ps,data(varn,li+n-1,:,lo,:),cs_res)
     793                     cs_res@gsnCenterString = "t=" + data&t(li) + "s  y"+ level
     794                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,lo,:),cs_res)
     795                     if (vector .EQ. 1) then
    822796                        if (check_vecp)
    823797                           vecres                  = True            ; vector only resources
     
    830804                           vecres@gsnLeftString    = " "             ; turn off left string
    831805                           vecres@tiXAxisString    = " "   
    832                            plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
    833                            overlay(plot1, plot_vec)
     806                           plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     807                           overlay(plot(n), plot_vec)
     808                        else 
     809                           vecres                  = True            ; vector only resources
     810                           vecres@gsnDraw          = False           ; don't draw
     811                           vecres@gsnFrame         = False           ; don't advance frame
     812                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     813                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     814                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     815                           vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
     816                           vecres@gsnLeftString    = " "             ; turn off left string
     817                           vecres@tiXAxisString    = " "   
     818                           plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     819                           plot(n) = plot_vec
    834820                        end if
    835                         plot(n) = plot1 
    836                      end do
     821                     end if
    837822                  end if
    838823
    839824                  if ( sort .eq. "layer" ) then
    840                      do n = 0, yb-ya
    841                         if ( data&z(li+n) .eq. -1 ) then
    842                            level = "-average"
    843                         else
    844                            level = "=" + data&y(li+n) + "m"
     825                     if ( data&z(li) .eq. -1 ) then
     826                        level = "-average"
     827                     else
     828                        level = "=" + data&y(li) + "m"
     829                     end if
     830                     cs_res@gsnCenterString = "t=" + data&t(lo) + "s  y"+ level
     831                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,li,:),cs_res)
     832                     if (vector .EQ. 1) then
     833                        if (check_vecp)
     834                           vecres                  = True            ; vector only resources
     835                           vecres@gsnDraw          = False           ; don't draw
     836                           vecres@gsnFrame         = False           ; don't advance frame
     837                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     838                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     839                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     840                           vecres@gsnRightString   = " "             ; turn off right string
     841                           vecres@gsnLeftString    = " "             ; turn off left string
     842                           vecres@tiXAxisString    = " "   
     843                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     844                           overlay(plot(n), plot_vec)
     845                        else 
     846                           vecres                  = True            ; vector only resources
     847                           vecres@gsnDraw          = False           ; don't draw
     848                           vecres@gsnFrame         = False           ; don't advance frame
     849                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     850                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     851                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     852                           vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
     853                           vecres@gsnLeftString    = " "             ; turn off left string
     854                           vecres@tiXAxisString    = " "   
     855                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     856                           plot(n) = plot_vec
    845857                        end if
    846                         cs_res@gsnCenterString = "t=" + data&t(lo-1) + "s  y"+ level
    847                         plot1 = gsn_csm_contour(wks_ps,data(varn,lo-1,:,li+n,:),cs_res)
    848                         if (check_vecp)
    849                            vecres                  = True            ; vector only resources
    850                            vecres@gsnDraw          = False           ; don't draw
    851                            vecres@gsnFrame         = False           ; don't advance frame
    852                            vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
    853                            vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
    854                            vecres@vcRefLengthF     = 0.05            ; define length of vec ref
    855                            vecres@gsnRightString   = " "             ; turn off right string
    856                            vecres@gsnLeftString    = " "             ; turn off left string
    857                            vecres@tiXAxisString    = " "   
    858                            plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
    859                            overlay(plot1, plot_vec)
    860                         end if
    861                         plot(n) = plot1
    862                      end do
     858                     end if
    863859                  end if                 
    864                  
    865860               end if
    866861
     
    881876                        level = "=" + data&z(lo) + "m"
    882877                     end if
    883                      do n = 0, tb-ta
    884                         cs_res@gsnCenterString = "t=" + data&t(li+n-1) + "s  x"+ level
    885                         plot1 = gsn_csm_contour(wks_ps,data(varn,li+n-1,:,:,lo),cs_res)
     878                     cs_res@gsnCenterString = "t=" + data&t(li) + "s  x"+ level
     879                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,:,lo),cs_res)
     880                     if (vector .EQ. 1) then
    886881                        if (check_vecp)
    887882                           vecres                  = True            ; vector only resources
     
    894889                           vecres@gsnLeftString    = " "             ; turn off left string
    895890                           vecres@tiXAxisString    = " "   
    896                            plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
    897                            overlay(plot1, plot_vec)
     891                           plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     892                           overlay(plot(n), plot_vec)
     893                        else 
     894                           vecres                  = True            ; vector only resources
     895                           vecres@gsnDraw          = False           ; don't draw
     896                           vecres@gsnFrame         = False           ; don't advance frame
     897                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     898                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     899                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     900                           vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
     901                           vecres@gsnLeftString    = " "             ; turn off left string
     902                           vecres@tiXAxisString    = " "   
     903                           plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     904                           plot(n) = plot_vec
    898905                        end if
    899                         plot(n) = plot1 
    900                      end do
     906                     end if
    901907                  end if
    902908
    903909                  if ( sort .eq. "layer" ) then
    904                      do n = 0, xb-xa
    905                         if ( data&z(li+n) .eq. -1 ) then
    906                            level = "-average"
    907                         else
    908                            level = "=" + data&z(li+n) + "m"
     910                     if ( data&z(li) .eq. -1 ) then
     911                        level = "-average"
     912                     else
     913                        level = "=" + data&z(li) + "m"
     914                     end if
     915                     cs_res@gsnCenterString = "t=" + data&t(lo) + "s  x"+ level
     916                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,:,li),cs_res)
     917                     if (vector .EQ. 1) then
     918                        if (check_vecp)
     919                           vecres                  = True            ; vector only resources
     920                           vecres@gsnDraw          = False           ; don't draw
     921                           vecres@gsnFrame         = False           ; don't advance frame
     922                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     923                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     924                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     925                           vecres@gsnRightString   = " "             ; turn off right string
     926                           vecres@gsnLeftString    = " "             ; turn off left string
     927                           vecres@tiXAxisString    = " "   
     928                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     929                           overlay(plot(n), plot_vec)
     930                        else 
     931                           vecres                  = True            ; vector only resources
     932                           vecres@gsnDraw          = False           ; don't draw
     933                           vecres@gsnFrame         = False           ; don't advance frame
     934                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     935                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     936                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     937                           vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
     938                           vecres@gsnLeftString    = " "             ; turn off left string
     939                           vecres@tiXAxisString    = " "   
     940                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     941                           plot(n) = plot_vec
    909942                        end if
    910                         cs_res@gsnCenterString = "t=" + data&t(lo-1) + "s  x"+ level
    911                         plot1 = gsn_csm_contour(wks_ps,data(varn,lo-1,:,:,li+n),cs_res)
    912                         if (check_vecp)
    913                            vecres                  = True            ; vector only resources
    914                            vecres@gsnDraw          = False           ; don't draw
    915                            vecres@gsnFrame         = False           ; don't advance frame
    916                            vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
    917                            vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
    918                            vecres@vcRefLengthF     = 0.05            ; define length of vec ref
    919                            vecres@gsnRightString   = " "             ; turn off right string
    920                            vecres@gsnLeftString    = " "             ; turn off left string
    921                            vecres@tiXAxisString    = " "   
    922                            plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
    923                            overlay(plot1, plot_vec)
    924                         end if
    925                         plot(n) = plot1
    926                      end do
     943                     end if
    927944                  end if
    928 
    929                end if
    930 
    931                ; ***************************************************
    932                ; merge plots onto one page
    933                ; ***************************************************
    934          
    935                gsn_panel(wks_ps, plot(0:n-1),(/no_lines,no_columns/),cs_resP)
    936 
    937                ; To hold no_lines and no_columns constant, it must be defined again:
    938 
    939                no_lines   = nl1
    940                no_columns = nc1
    941 
     945               end if         
     946               n=n+1   
    942947            end do     
    943948         end do 
    944949      end if
    945    end do   
     950   end do
     951
     952   ; ***************************************************
     953   ; merge plots onto one page
     954   ; ***************************************************
     955             
     956   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
     957      gsn_panel(wks_ps,plot(0:(no_time*no_layer*no_var)-1),(/no_var,no_layer*no_time/),cs_resP)
     958      print(" ")
     959      print("Outputs to .eps or .epsi have only one frame")
     960      print(" ")
     961   else
     962      do np = 0,no_layer*no_time*no_var-1,no_lines*no_columns   
     963         if ( np + no_lines*no_columns .gt. (no_layer*no_time*no_var)-1) then
     964            gsn_panel(wks_ps, plot(np:(no_layer*no_time*no_var)-1),(/no_lines,no_columns/),cs_resP)
     965         else
     966            gsn_panel(wks_ps, plot(np:np+no_lines*no_columns-1),(/no_lines,no_columns/),cs_resP)
     967         end if
     968      end do
     969   end if
    946970
    947971   print(" ")
Note: See TracChangeset for help on using the changeset viewer.