Changeset 157 for palm/trunk/SCRIPTS


Ignore:
Timestamp:
Apr 2, 2008 1:22:13 PM (16 years ago)
Author:
letzel
Message:
  • NCL scripts in trunk/SCRIPTS/NCL updated for vector plots
Location:
palm/trunk/SCRIPTS/NCL
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/NCL/.ncl_preferences

    r154 r157  
    55_________________________________________________________________________________________________
    66
    7 ___'file_in'_________[path/name.nc, i.e. ~/.../example.nc]______default = input file______[ALL]
     7___'file_in'_________[path/name.nc; i.e. ~/.../example.nc]______default = input file______[ALL]
    88input file
    9 ___'format_out'______[ncgm, ps, eps, epsi, pdf, x11]____________default = x11_____________[ALL]
     9___'format_out'______[ncgm; ps; eps; epsi; pdf; x11]____________default = x11_____________[ALL]
    1010x11
    11 ___'file_out'________[path/name, i.e. ~/.../test]_______________default = test____________[ALL]
     11___'file_out'________[path/name; i.e. ~/.../test]_______________default = test____________[ALL]
    1212test
    13 ___start_time_step___[0,1,...]__________________________________default = 1_______________[ALL]
     13___start_time_step___[0;1;...]__________________________________default = 1_______________[ALL]
    14141
    15 ___end_time_step_____[1,2,...]__________________________________default = nt-1____________[ALL]
    16 nt-1
    17 ___no_columns________[1,2,...]__________________________________default = 1_______________[ALL]
     15___end_time_step_____[1;2;...]__________________________________default = nt______________[ALL]
     16nt
     17___no_columns________[1;2;...]__________________________________default = 1_______________[ALL]
    18181
    19 ___no_lines__________[1,2,...]__________________________________default = 2_______________[ALL]
     19___no_lines__________[1;2;...]__________________________________default = 2_______________[ALL]
    20202
    21 ___'var'_____________[E dt umax,...]____________________________default = variables_______[ALL]
     21___'var'_____________[E,dt,umax,;...]___________________________default = variables_______[ALL]
    2222variables
    2323___combine___________[0] or [1]_________________________________default = 0_______________[PR]
     
    2525___number_comb_______[0] or [1]_________________________________default = 0_______________[PR]
    26260
    27 ___'c_var'___________[umax vmax wmax ,...]______________________default = c_variables_____[PR]
     27___'c_var'___________[umax,vmax,wmax,;...]______________________default = c_variables_____[PR]
    2828c_variables
    2929___dash______________[0] or [1]_________________________________default = 0_______________[PR]
     
    3131___black_____________[0] or [1]_________________________________default = 0_______________[PR]
    32320
    33 ___min_z_____________[0,10,...]_________________________________default = 0_______________[PR]
     33___min_z_____________[0;10;...]_________________________________default = 0_______________[PR]
    34340
    35 ___max_z_____________[100,1000,...]_____________________________default = max(z_pr)_______[PR]
     35___max_z_____________[100;1000;...]_____________________________default = max(z_pr)_______[PR]
    3636max(z_pr)
    3737___'sort'____________[time] or [layer]__________________________default = time____________[CS]
     
    4343___shape_____________[0] or [1]_________________________________default = 1_______________[CS]
    44441
    45 ___xyc_______________[0] or [1]_________________________________default = 1_______________[CS]
    46 1
     45___xyc_______________[0] or [1]_________________________________default = 0_______________[CS]
     460
    4747___xzc_______________[0] or [1]_________________________________default = 0_______________[CS]
    48480
     
    5151___xs________________[0,1,...]__________________________________default = 0_______________[CS]
    52520
    53 ___xe________________[1,2,...]__________________________________default = xdim____________[CS]
     53___xe________________[1;2;...]__________________________________default = xdim____________[CS]
    5454xdim
    55 ___ys________________[0,1,...]__________________________________default = 0_______________[CS]
    56  0
    57 ___ye________________[1,2,...]__________________________________default = ydim____________[CS]
     55___ys________________[0;1;...]__________________________________default = 0_______________[CS]
     560
     57___ye________________[1;2;...]__________________________________default = ydim____________[CS]
    5858ydim
    59 ___zs________________[0,1,...]__________________________________default = 0_______________[CS]
     59___zs________________[0;1;...]__________________________________default = 0_______________[CS]
    60600
    61 ___ze________________[1,2,...]__________________________________default = zdim____________[CS]
     61___ze________________[1;2;...]__________________________________default = zdim____________[CS]
    6262zdim
    63 ___end of file "parameter_list_cross_section__________________________________________________
    64 
    65 
    66 
     63___vector____________[0] or [1]_________________________________default = 0_______________[CS]
     640
     65___'vec1'____________[u,;v,;...]________________________________default = vec1____________[CS]
     66vec1
     67___'vec2'____________[u,;v,;...]________________________________default = vec2____________[CS]
     68vec2
     69__'plotvec'__________[u,;v,;...]________________________________default = plotvec_________[CS]
     70plotvec
     71___ref_mag___________[0.1;0.02;...]_____________________________default = 0.05____________[CS]
     720.05
     73___end of file ".ncl_preferences"_____________________________________________________________
  • palm/trunk/SCRIPTS/NCL/cross_sections.ncl

    r154 r157  
    11load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
     2load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    23load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
    34load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
     
    1112
    1213   if (isfilepresent("~/.ncl_preferences")) then
    13       parameter = asciiread("~/.ncl_preferences",63,"string")
     14      parameter = asciiread("~/.ncl_preferences",73,"string")
    1415      delete(parameter@_FillValue)
    1516   else
     
    177178      end if
    178179   end if
     180   if ( .not. isvar("vector") ) then                    ; sort of plots
     181      vector = 0
     182      if (parameter(63) .NE. "0") then
     183         vector = stringtointeger(parameter(63))
     184         if (stringtointeger(parameter(63)) .NE. 1) then
     185            print(" ")
     186            print("Please set 'vector' to 0 or 1")
     187            print(" ")
     188            exit
     189         end if   
     190      end if
     191   end if
     192   if ( .not. isvar("ref_mag") ) then                           ; sort of plots
     193      ref_mag = 0.05
     194      if (parameter(71) .NE. "0.05") then
     195         ref_mag = stringtofloat(parameter(71))   
     196      end if
     197   end if
    179198
    180199   ; ***************************************************
     
    257276   print(" ")
    258277
    259    do varn=0,dim-1   
    260 
    261       data_all = f->$vNam(varn)$
     278   ; *********************************************
     279   ; set up of start_time_step and end_time_step
     280   ; *********************************************
     281
     282   t = f->time
     283   nt = dimsizes(t)
     284     
     285   ; *********************************************     
     286   ; start of time step and different types of mistakes that could be done
     287   ; *********************************************
     288
     289   if ( .not. isvar("start_time_step") ) then           
     290      start_time_step = 1
     291      if (parameter(13) .NE. "1") then
     292         if (parameter(13) .LE. "0")
     293            print(" ")
     294            print("Begin with time step 1")
     295            print(" ")
     296            exit
     297         end if
     298         if (stringtointeger(parameter(13)) .GT. nt)
     299            print(" ")
     300            print("'start_time_step' = "+ parameter(13) +" is greater than available time steps = " + (nt))
     301            print(" ")
     302            exit
     303         end if
     304         start_time_step = stringtointeger(parameter(13)) 
     305      end if
     306   else
     307      if (start_time_step .LE. 0)
     308         print(" ")
     309         print("Begin with time step 1")
     310         print(" ")
     311         exit
     312      end if
     313      if (start_time_step .GT. nt)
     314         print(" ")
     315         print("'start_time_step' = "+ start_time_step +" is greater than available time steps = " + (nt))
     316         print(" ")
     317         exit
     318      end if
     319   end if
     320
     321   ; ****************************************************
     322   ; end of time step and different types of mistakes that could be done
     323   ; ****************************************************
     324
     325   if ( .not. isvar("end_time_step") ) then             
     326      end_time_step = nt
     327      if (parameter(15) .NE. "nt") then
     328         if (parameter(15) .LE. "0")
     329            print(" ")
     330            print("'end_time_step' = "+parameter(15)+ " is too small; 'end_time_step' should be at least 1 ")
     331            print(" ")
     332            exit
     333         end if
     334         if (stringtointeger(parameter(15)) .GT. nt)
     335            print(" ")
     336            print("'end_time_step' = "+ parameter(15) +" is greater than available time steps = " + (nt))
     337            print(" ")
     338            exit
     339         end if
     340         if (stringtointeger(parameter(15)) .LT. stringtointeger(parameter(13)) )
     341            print(" ")
     342            print("'end_time_step' = "+ parameter(15) +" is lower than 'start_time_step' = "+parameter(15))
     343            print(" ")
     344            exit
     345         end if
     346         end_time_step = stringtointeger(parameter(15)) 
     347      end if   
     348   else
     349      if (end_time_step .LE. 0)
     350         print(" ")
     351         print("'end_time_step' = "+end_time_step+ " is too small; 'end_time_step' should be at least 1 ")
     352         print(" ")
     353         exit
     354      end if
     355      if (end_time_step .GT. nt)
     356         print(" ")
     357         print("'end_time_step' = "+ end_time_step +" is greater than available time steps = "+(nt))
     358         print(" ")
     359         exit
     360      end if
     361      if (end_time_step .LT. start_time_step)
     362         print(" ")
     363         print("'end_time_step' = "+end_time_step +" is lower than 'start_time_step' = "+start_time_step)
     364         print(" ")
     365         exit
     366      end if
     367   end if
     368
     369   ; ****************************************************
     370   ; set up variables for vector plot if required
     371   ; ****************************************************   
     372
     373   if (vector .EQ. 1) then
     374      if ( .not. isvar("plotvec") ) then
     375         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
     382      end if
     383      if ( .not. isvar("vec1") ) then
     384         vec1 = parameter(65)
     385         if (parameter(65) .EQ. "vec1") then
     386            print(" ")
     387            print("Please indicate Vector 1 ('vec1') for Vector-Plot")
     388            print(" ")
     389            exit
     390         end if
     391      end if
     392      if ( .not. isvar("vec2") ) then
     393         vec2 = parameter(67)
     394         if (parameter(67) .EQ. "vec2") then
     395            print(" ")
     396            print("Please indicate Vector 2 ('vec2') for Vector-Plot")
     397            print(" ")
     398            exit
     399         end if
     400      end if             
     401   end if
     402
     403   check_vec1 = False
     404   check_vec2 = False
     405   check_vecp = False
     406
     407   ; ****************************************************
     408   ; get data for plots
     409   ; ****************************************************
     410
     411   do varn=0,dim-1 
    262412
    263413      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
     
    266416      if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
    267417         check = False
    268       end if
    269      
     418      end if     
    270419      if (  isvar("var") ) then 
    271420         check = isStrSubset( var,vNam(varn)+",")
     
    274423         var = parameter(21)
    275424         check = isStrSubset( var,vNam(varn)+"," )
    276       end if
     425      end if  
    277426
    278427      if(check) then
    279 
    280          print("plot of "+vNam(varn))
    281          print(" ")
    282 
    283          ; *********************************************
    284          ; set up of start_time_step and end_time_step
    285          ; *********************************************
    286 
    287          t = f->time
    288          nt = dimsizes(t)
    289          
    290          ; *********************************************       
    291          ; start of time step and different types of mistakes that could be done
    292          ; *********************************************
    293 
    294          if ( .not. isvar("start_time_step") ) then     
    295             start_time_step = 1
    296             if (parameter(13) .NE. "1") then
    297                if (parameter(13) .LE. "0")
    298                   print(" ")
    299                   print("Begin with time step 1")
    300                   print(" ")
    301                   exit
    302                end if
    303                if (stringtointeger(parameter(13)) .GE. nt)
    304                   print(" ")
    305                   print("'start_time_step' = "+ parameter(13) +" is greater than available time steps = " + (nt-1))
    306                   print(" ")
    307                   exit
    308                end if
    309                start_time_step = stringtointeger(parameter(13)) 
    310             end if
    311          else
    312             if (start_time_step .LE. 0)
    313                print(" ")
    314                print("Begin with time step 1")
    315                print(" ")
    316                exit
    317             end if
    318             if (start_time_step .GE. nt)
    319                print(" ")
    320                print("'start_time_step' = "+ start_time_step +" is greater than available time steps = " + (nt-1))
    321                print(" ")
    322                exit
    323             end if
    324          end if
    325 
    326          ; ****************************************************
    327          ; end of time step and different types of mistakes that could be done
    328          ; ****************************************************
    329 
    330          if ( .not. isvar("end_time_step") ) then       
    331             end_time_step = nt-1
    332             if (parameter(15) .NE. "nt-1") then
    333                if (parameter(15) .LE. "0")
    334                   print(" ")
    335                   print("'end_time_step' = "+parameter(15)+ " is too small; 'end_time_step' should be at least 1 ")
    336                   print(" ")
    337                   exit
    338                end if
    339                if (stringtointeger(parameter(15)) .GE. nt)
    340                   print(" ")
    341                   print("'end_time_step' = "+ parameter(15) +" is greater than available time steps = " + (nt-1))
    342                   print(" ")
    343                   exit
    344                end if
    345                if (stringtointeger(parameter(15)) .LT. stringtointeger(parameter(13)) )
    346                   print(" ")
    347                   print("'end_time_step' = "+ parameter(15) +" is lower than 'start_time_step' = "+parameter(15))
    348                   print(" ")
    349                   exit
    350                end if
    351                end_time_step = stringtointeger(parameter(15)) 
    352             end if   
    353          else
    354             if (end_time_step .LE. 0)
    355                print(" ")
    356                print("'end_time_step' = "+end_time_step+ " is too small; 'end_time_step' should be at least 1 ")
    357                print(" ")
    358                exit
    359             end if
    360             if (end_time_step .GE. nt)
    361                print(" ")
    362                print("'end_time_step' = "+ end_time_step +" is greater than available time steps = "+(nt-1))
    363                print(" ")
    364                exit
    365             end if
    366             if (end_time_step .LT. start_time_step)
    367                print(" ")
    368                print("'end_time_step' = "+end_time_step +" is lower than 'start_time_step' = "+start_time_step)
    369                print(" ")
    370                exit
    371             end if
    372          end if
     428       
     429         data_all = f->$vNam(varn)$
    373430
    374431         ; ****************************************************
     
    378435         xdim = dimsizes(data_all(0,0,0,:)) - 1   
    379436         ydim = dimsizes(data_all(0,0,:,0)) - 1       
    380          zdim = dimsizes(data_all(0,:,0,0)) - 1   
    381    
     437         zdim = dimsizes(data_all(0,:,0,0)) - 1 
     438       
    382439         if ( .not. isvar("xe")) then     ; output x-coordinate range end (in index)
    383440            xe = xdim
     
    398455            end if
    399456         else
    400            if (xe .GT. xdim) then
    401               print(" ")
    402               print("range end for x-coordinate = "+xe+" is higher than available dimensions = "+xdim)
    403               print(" ")
    404               exit
    405            end if
    406            if (xe .LT. 0 .OR. xe .LT. xs) then
    407               print(" ")
    408               print("range end for x-coordinate = "+xe+" is too small")
    409               print(" ")
    410               exit
    411            end if                 
    412          end if
     457            if (xe .GT. xdim) then
     458               print(" ")
     459               print("range end for x-coordinate = "+xe+" is higher than available dimensions = "+xdim)
     460               print(" ")
     461               exit
     462            end if
     463            if (xe .LT. 0 .OR. xe .LT. xs) then
     464               print(" ")
     465               print("range end for x-coordinate = "+xe+" is too small")
     466               print(" ")
     467               exit
     468            end if                 
     469         end if
     470
    413471         if ( .not. isvar("ye")) then     ; output y-coordinate range end (in index)
    414472            ye = ydim
     
    433491               print("range end for y-coordinate = "+ye+" is higher than available dimensions = "+ydim)
    434492               print(" ")
     493               exit
     494            end if
     495            if (ye .LT. 0 .OR. ye .LT. ys) then
     496               print(" ")
     497               print("range end for y-coordinate = "+ye+" is too small")
     498               print(" ")
    435499               exit
    436500            end if
    437             if (ye .LT. 0 .OR. ye .LT. ys) then
    438                print(" ")
    439                print("range end for y-coordinate = "+ye+" is too small")
    440                print(" ")
    441                exit
    442             end if
    443          end if
     501         end if
     502
    444503         if ( .not. isvar("ze")) then     ; output z-coordinate range end (in index)
    445504            ze = zdim
     
    472531               exit
    473532            end if
    474          end if
     533         end if   
     534         delete(data_all)
     535      end if 
     536   end do
     537
     538   data  = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,(xe-xs)+1/),float)
     539
     540   ; ****************************************************
     541   ; define inner and outer loops depending on "sort"
     542   ; ****************************************************       
     543   
     544   if ( xyc .eq. 1 ) then
     545      lays = zs
     546      laye = ze
     547   end if
     548   if ( xzc .eq. 1 ) then
     549      lays = ys
     550      laye = ye
     551   end if
     552   if ( yzc .eq. 1) then
     553      lays = xs
     554      laye = xe
     555   end if
     556
     557   if ( sort .eq. "time" ) then
     558      lis = start_time_step
     559      lie = end_time_step
     560      los = lays
     561      loe = laye
     562   else
     563      lis = lays
     564      lie = laye
     565      los = start_time_step
     566      loe = end_time_step
     567   end if
     568
     569   check = True
     570   v1=0
     571   v2=0
     572
     573   do varn=0,dim-1 
     574     
     575      data_all = f->$vNam(varn)$
     576
     577      if (vector .EQ. 1) then   
     578         check_vec1 = isStrSubset( vec1,vNam(varn)+",")
     579         check_vec2 = isStrSubset( vec2,vNam(varn)+",")
     580      end if
     581           
     582      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
     583         check = False
     584      end if
     585      if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
     586         check = False
     587      end if     
     588      if (  isvar("var") ) then 
     589         check = isStrSubset( var,vNam(varn)+",")
     590      end if
    475591 
    476          ; Defining inner and outer loop depending on variable
    477          ; "sort" (values: time or layers)
     592      if (parameter(21) .NE. "variables") then
     593         var = parameter(21)
     594         check = isStrSubset( var,vNam(varn)+"," )
     595      end if 
     596
     597      if(check) then
     598
     599         if (vector .EQ. 1) then
     600            if (vNam(varn)+"," .EQ. vec1) then
     601               v1=v1+1
     602            end if
     603            if (vNam(varn)+"," .EQ. vec2) then
     604               v2=v2+1
     605            end if
     606         end if
     607
     608         data(varn,:,:,:,:)=data_all(0:nt-1,zs:ze,ys:ye,xs:xe)
     609         if (check_vec1) then
     610            print("in vec1")
     611            vect1=data_all
     612         end if
     613         if (check_vec2) then
     614             print("in vec2")
     615            vect2=data_all
     616         end if
     617
     618         data!0 = "var"
     619         data!1 = "t"
     620         data!2 = "z"
     621         data!3 = "y"
     622         data!4 = "x"   
     623
     624      end if
     625
     626      delete(data_all)
     627
     628   end do 
     629
     630   if (vector .EQ. 1) then
     631      if (v1 .EQ. 0)then
     632         print(" ")
     633         print("Varible for vector-plot ('vec1') must be one of the varibles for plot ('var')")
     634         print(" ")
     635         exit
     636      end if
     637
     638      if (v2 .EQ. 0)then
     639         print(" ")
     640         print("Varible for vector-plot ('vec2') must be one of the varibles for plot ('var')")
     641         print(" ")
     642         exit
     643      end if
     644   end if
     645
     646   ; ***************************************************
     647   ; create plots
     648   ; ***************************************************
     649
     650   check = True
     651
     652   do varn=0,dim-1
     653
     654      if (vector .EQ. 1) then   
     655         check_vecp = isStrSubset( plotvec,vNam(varn)+",")
     656      end if
     657
     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     
     664      if (  isvar("var") ) then 
     665         check = isStrSubset( var,vNam(varn)+",")
     666      end if
     667      if (parameter(21) .NE. "variables") then
     668         var = parameter(21)
     669         check = isStrSubset( var,vNam(varn)+"," )
     670      end if
    478671   
    479          if ( xyc .eq. 1 ) then
    480             lays = zs
    481             laye = ze
    482          end if
    483          if ( xzc .eq. 1 ) then
    484             lays = ys
    485             laye = ye
    486          end if
    487          if ( yzc .eq. 1) then
    488             lays = xs
    489             laye = xe
    490          end if
    491 
    492          if ( sort .eq. "time" ) then
    493             lis = start_time_step
    494             lie = end_time_step
    495             los = lays
    496             loe = laye
    497          else
    498             lis = lays
    499             lie = laye
    500             los = start_time_step
    501             loe = end_time_step
    502          end if
    503 
    504 
    505          ; loops over time and layer (order depends on "sort")
     672      if(check) then
     673     
     674         ; ****************************************************
     675         ; loops over time and layer
     676         ; ****************************************************
    506677
    507678         do lo = los, loe                                       ; lo: loop outer
    508             do li = lis, lie, no_lines*no_columns               ; li: loop inner
    509 
    510                print("page "+page)
    511                page = page + 1
    512 
    513                ; Defining indices for reading data needed to plot one page
    514                ; The indices depend on the parameter "sort"
    515 
     679            do li = lis, lie, no_lines*no_columns               ; li: loop inner
     680               
    516681               if ( sort .eq. "time" ) then
    517682                  ta = li
     
    570735                     zb = ze
    571736                  end if
    572                end if
    573                            
    574                data = data_all(ta:tb,za:zb,ya:yb,xa:xb)
    575        
    576                data!0 = "t"
    577                data!1 = "z"
    578                data!2 = "y"
    579                data!3 = "x"
    580 
    581                ; set up labels and plot
    582 
     737               end if   
     738
     739               ; ****************************************************
    583740               ; xy cross section
    584 
    585                if ( xyc .eq. 1 ) then
     741               ; ****************************************************
     742
     743               if ( xyc .eq. 1 ) then
     744               
    586745                  cs_res@tiXAxisString   = "x [m]"
    587746                  cs_res@tiYAxisString   = "y [m]"
    588 
     747                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
     748                 
    589749                  if ( sort .eq. "time" ) then
    590                      if ( data&z(0) .eq. -1 ) then
     750                     if ( data&z(lo) .eq. -1 ) then
    591751                        level = "-average"
    592752                     else
    593                         level = "=" + data&z(0) + "m"
     753                        level = "=" + data&z(lo) + "m"
     754                     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) 
     758                        if (check_vecp)
     759                           vecres                  = True            ; vector only resources
     760                           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
     765                           vecres@gsnRightString   = " "             ; turn off right string
     766                           vecres@gsnLeftString    = " "             ; turn off left string
     767                           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
     773                  end if
     774
     775                  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"
     781                        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
     799                  end if
     800
     801               end if
     802
     803               ; ****************************************************
     804               ; xz cross section
     805               ; ****************************************************
     806
     807               if ( xzc .eq. 1 ) then
     808       
     809                  cs_res@tiXAxisString   = "x [m]"
     810                  cs_res@tiYAxisString   = "z [m]"
     811                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
     812
     813                  if ( sort .eq. "time" ) then
     814                     if ( data&z(lo) .eq. -1 ) then
     815                        level = "-average"
     816                     else
     817                        level = "=" + data&y(lo) + "m"
    594818                     end if
    595819                     do n = 0, tb-ta
    596                         cs_res@gsnCenterString = "t=" + data&t(n) + "s  z"+ level
    597                         plot(n) = gsn_csm_contour(wks_ps,data(n,0,:,:),cs_res) 
     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)
     822                        if (check_vecp)
     823                           vecres                  = True            ; vector only resources
     824                           vecres@gsnDraw          = False           ; don't draw
     825                           vecres@gsnFrame         = False           ; don't advance frame
     826                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     827                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     828                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     829                           vecres@gsnRightString   = " "             ; turn off right string
     830                           vecres@gsnLeftString    = " "             ; turn off left string
     831                           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)
     834                        end if
     835                        plot(n) = plot1 
    598836                     end do
    599837                  end if
    600838
    601839                  if ( sort .eq. "layer" ) then
    602                      do n = 0, zb-za
    603                         if ( data&z(n) .eq. -1 ) then
     840                     do n = 0, yb-ya
     841                        if ( data&z(li+n) .eq. -1 ) then
    604842                           level = "-average"
    605843                        else
    606                            level = "=" + data&z(n) + "m"
     844                           level = "=" + data&y(li+n) + "m"
    607845                        end if
    608                         cs_res@gsnCenterString = "t=" + data&t(0) + "s  z"+ level
    609                         plot(n) = gsn_csm_contour(wks_ps,data(0,n,:,:),cs_res)
     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
    610862                     end do
    611                   end if
     863                  end if                 
     864                 
    612865               end if
    613866
    614                ; xz cross section
    615 
    616                if ( xzc .eq. 1 ) then
    617                   cs_res@tiXAxisString   = "x [m]"
     867               ; ****************************************************
     868               ; yz cross section
     869               ; ****************************************************
     870
     871               if ( yzc .eq. 1 ) then
     872               
     873                  cs_res@tiXAxisString   = "y [m]"
    618874                  cs_res@tiYAxisString   = "z [m]"
    619  
     875                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
     876
    620877                  if ( sort .eq. "time" ) then
    621                      if ( data&y(0) .eq. -1 ) then
     878                     if ( data&z(lo) .eq. -1 ) then
    622879                        level = "-average"
    623880                     else
    624                         level = "=" + data&y(0) + "m"
     881                        level = "=" + data&z(lo) + "m"
    625882                     end if
    626883                     do n = 0, tb-ta
    627                         cs_res@gsnCenterString = "t=" + data&t(n) + "s  z"+ level
    628                         plot(n) = gsn_csm_contour(wks_ps,data(n,:,0,:),cs_res) 
     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)
     886                        if (check_vecp)
     887                           vecres                  = True            ; vector only resources
     888                           vecres@gsnDraw          = False           ; don't draw
     889                           vecres@gsnFrame         = False           ; don't advance frame
     890                           vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
     891                           vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
     892                           vecres@vcRefLengthF     = 0.05            ; define length of vec ref
     893                           vecres@gsnRightString   = " "             ; turn off right string
     894                           vecres@gsnLeftString    = " "             ; turn off left string
     895                           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)
     898                        end if
     899                        plot(n) = plot1 
    629900                     end do
    630901                  end if
    631902
    632903                  if ( sort .eq. "layer" ) then
    633                      do n = 0, yb-ya
    634                         if ( data&y(n) .eq. -1 ) then
     904                     do n = 0, xb-xa
     905                        if ( data&z(li+n) .eq. -1 ) then
    635906                           level = "-average"
    636907                        else
    637                            level = "=" + data&y(n) + "m"
     908                           level = "=" + data&z(li+n) + "m"
    638909                        end if
    639                         cs_res@gsnCenterString = "t=" + data&t(0) + "s  z"+ level
    640                         plot(n) = gsn_csm_contour(wks_ps,data(0,:,n,:),cs_res)
     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
    641926                     end do
    642927                  end if
     928
    643929               end if
    644930
    645                ; yz cross section
    646 
    647                if ( yzc .eq. 1 ) then
    648                   cs_res@tiXAxisString   = "y [m]"
    649                   cs_res@tiYAxisString   = "z [m]"
    650  
    651                   if ( sort .eq. "time" ) then
    652                      if ( data&x(0) .eq. -1 ) then
    653                         level = "-average"
    654                      else
    655                         level = "=" + data&x(0) + "m"
    656                      end if
    657                      do n = 0, tb-ta
    658                         cs_res@gsnCenterString = "t=" + data&t(n) + "s  x"+ level
    659                         plot(n) = gsn_csm_contour(wks_ps,data(n,:,:,0),cs_res) 
    660                      end do
    661                   end if
    662 
    663                   if ( sort .eq. "layer" ) then
    664                      do n = 0, xb-xa
    665                         if ( data&x(n) .eq. -1 ) then
    666                            level = "-average"
    667                         else
    668                            level = "=" + data&x(n) + "m"
    669                         end if
    670                         cs_res@gsnCenterString = "t=" + data&t(0) + "s  x"+ level
    671                         plot(n) = gsn_csm_contour(wks_ps,data(0,:,:,n),cs_res)
    672                      end do
    673                   end if
    674                end if
    675 
    676                delete(data)
    677 
    678                ; ***************************************************
     931               ; ***************************************************
    679932               ; merge plots onto one page
    680933               ; ***************************************************
     
    689942            end do     
    690943         end do 
    691       end if 
    692  
    693       delete(data_all)
    694 
     944      end if
    695945   end do   
    696946
  • palm/trunk/SCRIPTS/NCL/profiles.ncl

    r154 r157  
    1010
    1111   if (isfilepresent("~/.ncl_preferences")) then
    12       parameter = asciiread("~/.ncl_preferences",63,"string")
     12      parameter = asciiread("~/.ncl_preferences",73,"string")
    1313      delete(parameter@_FillValue)
    1414   else
     
    160160   if ( .not. isvar("end_time_step") ) then             
    161161      end_time_step = nt-1
    162       if (parameter(15) .NE. "nt-1") then
     162      if (parameter(15) .NE. "nt") then
    163163         if (parameter(15) .LE. "0")
    164164            print(" ")
     
    420420      e=-1
    421421   end if 
    422    
     422
    423423   do varn = 0, dim-1   
    424424     
     
    470470
    471471         temp = f->$vNam(varn)$     
    472          data = temp(start_time_step:end_time_step,:)     
     472         data = temp(start_time_step:end_time_step,:)   
     473         testx= data*100 
    473474         print("         plot of " + vNam(varn))
    474475         data!1 = "z"
     
    487488       
    488489         plot(n) = gsn_csm_xy(wks,data,z_pr,res) 
    489       
     490   
    490491         delete(temp)
    491492         delete(data)
  • palm/trunk/SCRIPTS/NCL/timeseries.ncl

    r154 r157  
    1111   
    1212   if (isfilepresent("~/.ncl_preferences")) then
    13       parameter = asciiread("~/.ncl_preferences",63,"string")
     13      parameter = asciiread("~/.ncl_preferences",73,"string")
    1414      delete(parameter@_FillValue)
    1515   else
     
    118118   if ( .not. isvar("end_time_step") ) then             
    119119      end_time_step = nt-1
    120       if (parameter(15) .NE. "nt-1") then
     120      if (parameter(15) .NE. "nt") then
    121121         if (parameter(15) .LE. "0")
    122122            print(" ")
Note: See TracChangeset for help on using the changeset viewer.