Changeset 342 for palm/trunk/SCRIPTS/NCL


Ignore:
Timestamp:
Jun 18, 2009 1:54:07 PM (15 years ago)
Author:
heinze
Message:

Plots of profiles appear in the order specified by the variable var.

Location:
palm/trunk/SCRIPTS/NCL
Files:
2 edited

Legend:

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

    r267 r342  
    195195      ; data type: string
    196196      ;
    197       ; example: var = ",u,v,w"
     197      ; example: var = ",u,v,w,"
    198198      ;
    199199      ; default:   "all" (all available variables are plotted)
     
    788788      ; data type: string
    789789      ;
    790       ; example: var = ",u,v,w";
     790      ; example: var = ",u,v,w,";
    791791      ;
    792792      ; default:   "all" (all available variables are plotted)
     
    17261726      ; data type: string
    17271727      ;
    1728       ; example: var = ",u,v,w"
     1728      ; example: var = ",u,v,w,"
    17291729      ;
    17301730      ; default:   "all" (all available variables are plotted)
     
    21412141      ; data type: string
    21422142      ;
    2143       ; example: var = ",u,v,w"
     2143      ; example: var = ",u,v,w,"
    21442144      ;
    21452145      ; default:   "all" (all available variables are plotted)
  • palm/trunk/SCRIPTS/NCL/profiles.ncl

    r324 r342  
    357357   ListSetType(f,"cat")
    358358   
    359    vNam = getfilevarnames(f_att)
     359   vNam = getfilevarnames(f_att)    
    360360   
    361361   if (nof .EQ. 0)then
     
    401401      end if
    402402   end do
     403 
     404   if (var .NE. "all") then
     405      ;rearrange the order of the variables in vNam so that the variables
     406      ;specified by "var" are in the top of vNam
     407
     408      vNam_static = new((/dim/),string)
     409      vNam_temp   = new((/dim/),string)
     410     
     411      var_char    = stringtocharacter(var)
     412      no_char     = dimsizes(var_char)
     413      comma       = 0
     414       
     415      do j=0,no_char-1
     416         if(var_char(j) .eq. ",")
     417            comma = comma + 1
     418         end if
     419      end do
     420
     421      if(comma .le. 1)
     422          print(" ")
     423          print("The variables 'var="+var+"'" )
     424          print("do not exist on your input file;")
     425          print("be sure to have one comma before and after each variable")
     426          print(" ")
     427          exit
     428      end if
     429
     430      indices = new((/comma/),integer)
     431      comma   = 0
     432       
     433      do j=0,no_char-1
     434         if(var_char(j) .eq. ",")
     435           indices(comma) = j
     436           comma          = comma + 1
     437         end if
     438      end do
     439
     440      do j=0,comma-2
     441         vNam_temp(j) = charactertostring(var_char(indices(j)+1:indices(j+1)-1))
     442      end do
     443
     444      do j=0,comma-2
     445         vNam_static(j) = vNam_temp(comma - 2 - j)
     446      end do
     447
     448      vNam_temp   = vNam_static
     449      vNam_static = ""
     450
     451      if (prof3d .EQ. 0) then
     452         i = 0
     453         do j=0,dim-1,2
     454            vNam_static(j)   = vNam_temp(i)
     455            vNam_static(j+1) = "z" + vNam_static(j)
     456            i = i+1
     457            if(i .eq. comma-1)
     458                break
     459            end if
     460         end do
     461
     462         delete(vNam_temp)
     463         count_variable = 2*(comma-1)
     464      else
     465         i = 0
     466          do j=0,dim-1,1
     467             vNam_static(j) = vNam_temp(i)
     468             i = i+1
     469             if(i .eq. comma-1)
     470                 break
     471             end if
     472          end do
     473
     474          delete(vNam_temp)
     475          count_variable = comma-1
     476      end if
     477
     478      counter  = 0
     479      counter2 = 0
     480      do j=0,dim-1
     481         counter = 0
     482         do i = 0, count_variable - 1       
     483            if(vNam_static(i) .ne. vNam(j))
     484               counter = counter + 1
     485            end if
     486         end do
     487     
     488         if (counter .eq. count_variable)
     489            vNam_static(count_variable + counter2) = vNam(j)
     490            counter2 = counter2 + 1
     491         end if
     492      end do
     493     
     494      vNam = vNam_static
     495      delete(vNam_static)
     496    end if
    403497
    404498   ;-----------------------------------------------------below steps only for first file -> nof=0
     
    417511   if (prof3d .EQ. 0) then
    418512 
    419    do varn = dim-1,0,1
     513   do varn=0,dim-1
    420514      if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
    421          varn=varn-1
    422515         continue
    423516      end if
     
    531624         end if
    532625      end if
    533       varn=varn-1
    534626   end do
    535627
    536    do varn=dim-1,0,1
     628   do varn=0,dim-1
    537629      if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
    538          varn=varn-1
    539630         continue
    540631      end if
     
    703794         end if
    704795      end if
    705       varn=varn-1
    706796   end do
    707797   
     
    733823      if (co .EQ. 0) then
    734824         print(" ")
    735          print("The variables 'var="+var+"' do not exist on your input file;")
    736          print("be sure to have one comma berfore and after each variable")
    737          print(" ")
    738          exit
     825         print("The variables 'var="+var+"'" )
     826         print("do not exist on your input file;")
     827         print("be sure to have one comma before and after each variable")
     828         print(" ")
     829         exit           
    739830      end if
    740831   end if
     
    789880      exit
    790881   end if
    791    
     882 
    792883   if (prof3d .EQ. 1)then
    793884      t_all = f[:]->time
     
    876967   do i=0,nt-1     
    877968      if (end_time_step .GE. (t_all(i)-delta_t/2)/3600 .AND. end_time_step .LT. (t_all(i)+delta_t/2)/3600)then
    878          print((t_all(i)-delta_t/2)/3600)
    879          print((t_all(i)+delta_t/2)/3600)
    880969         et=i
    881970         break
     
    896985   end_time_step=round(et,3)
    897986   
    898    print(start_time_step)
    899    print(end_time_step)
    900 
    901987   print(" ")
    902988   print("Output of time steps from "+t_all(start_time_step)/3600+" h = "+t_all(start_time_step)+" s => index = "+start_time_step)
     
    10541140         end if   
    10551141      end if
     1142   
    10561143      if (isvar("z_w"))then
    10571144         if (min_z .GE. max(z_w) ) then
     
    14961583
    14971584      if(check) then
    1498          if (isStrSubset(vNam(varn),"_0" ))then
    1499             print(" ")
    1500             print("If you have Outputs of statistic regions you cannot overlay variables; 'over' is set to 0")
    1501             print(" ")
    1502             over = 0
    1503          end if
    1504        
     1585         
    15051586         count_var=count_var+1
    15061587
    15071588         if (prof3d .EQ. 0) then
    15081589            if (t_null)then
    1509                temp = f[:]->$vNam(varn)$(1:,:)
     1590               temp = f[:]->$vNam(varn)$(1:,:) 
    15101591            else
    15111592               temp = f[:]->$vNam(varn)$
     
    15201601                     data_temp = temp(j,i,start_y:end_y,start_x:end_x)
    15211602                     data(varn,j-start_time_step,i-1) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
     1603                     delete(data_temp)
    15221604                  end do
    15231605               end do
     
    15311613                     data_temp!1 = "z"
    15321614                     data(varn,j-start_time_step,i) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
     1615                     delete(data_temp)
    15331616                  end do
    15341617               end do
     
    27012784   if (count_var .EQ. 0) then
    27022785      print(" ")
    2703       print("The variables 'var="+var+"' do not exist on your input file;")
    2704       print("be sure to have one comma berfore and after each variable")
    2705       print(" ")
    2706       exit
     2786      print("The variables 'var="+var+"'" )
     2787      print("do not exist on your input file;")
     2788      print("be sure to have one comma before and after each variable")
     2789      print(" ")
     2790      exit       
     2791   end if
     2792
     2793   if (isStrSubset(data@long_name," SR " ))then
     2794      print(" ")
     2795      print("If you have outputs of statistic regions you cannot overlay variables;")
     2796      print("'over' is set to 0" )
     2797      print(" ")
     2798      over = 0
    27072799   end if
    27082800   
     
    37623854           
    37633855            com=isStrSubset( c_var,","+vNam(varn)+"," )
    3764        
    37653856            if (com)then
    37663857               co = co+1           
     
    38063897            print("'c_var'(= "+c_var+") must include two variables of the general plots = ")
    38073898            print("- "+com_var_avail)
    3808             print("be sure to have one comma berfore and after the variable")
     3899            print("be sure to have one comma before and after the variable")
    38093900            print(" ")
    38103901            exit 
     
    38203911            print("'c_var'(= "+c_var+") must include three variables of the general plots = ")
    38213912            print("- "+com_var_avail)
    3822             print("be sure to have one comma berfore and after the variable")
     3913            print("be sure to have one comma before and after the variable")
    38233914            print(" ")
    38243915            exit
Note: See TracChangeset for help on using the changeset viewer.