Ignore:
Timestamp:
Dec 10, 2008 9:14:34 AM (15 years ago)
Author:
letzel
Message:
  • User can check user parameters and deduce further quantities in user_check_parameters
  • Topography definition according to new user parameter topography_grid_convention (init_grid, modules, user_header, user_init_grid, user_parin)
  • New subdirectory trunk/EXAMPLES with two examples highlighting the topography_grid_convention
File:
1 edited

Legend:

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

    r195 r218  
    3737   if (file_1 .EQ. "File in") then
    3838      print(" ")
    39       print("Please provide 1st input file 'file_1=' in 'ncl_preferences.ncl'")
     39      print("Declare input file 'file_1=' in 'ncl_preferences.ncl' or prompt")
    4040      print(" ")
    4141      exit
     
    4343      file_in = file_1   
    4444   end if
    45    if (.not. isfilepresent(file_in)) then
    46       print(" ")
    47       print("1st input file: '"+file_in+"' does not exist")
    48       print(" ")
    49       exit
    50    end if
    5145
    5246   if (format_out .NE. "x11" .AND. format_out .NE. "pdf" .AND. format_out .NE. "eps" .AND. format_out .NE. "ps" .AND. format_out .NE. "epsi" .AND. format_out .NE. "ncgm")then
     
    7367   if (fill_mode .NE. "AreaFill" .AND. fill_mode .NE. "RasterFill" .AND. fill_mode .NE. "CellFill") then
    7468      print(" ")
    75       print("Your 'fill_mode'= "+fill_mode+" is invalid and set to 'AreaFill'")
     69      print("'fill_mode'= "+fill_mode+" is invalid and set to 'AreaFill'")
    7670      print(" ")
    7771      fill_mode = "AreaFill"
     
    108102   if (xyc .EQ. 0 .AND. xzc .EQ. 0 .AND. yzc .EQ. 0) then
    109103      print(" ")
    110       print("Please select one crossection (xyc=1 or xzc=1 or yzc=1)")
     104      print("Select one crossection (xyc=1 or xzc=1 or yzc=1)")
    111105      print(" ")
    112106      exit
     
    115109      if (xzc .EQ. 1 .OR. yzc .EQ. 1) then
    116110         print(" ")
    117          print("Please select just one crossection (xyc=1 or xzc=1 or yzc=1)")
     111         print("Select just one crossection (xyc=1 or xzc=1 or yzc=1)")
    118112         print(" ")
    119113         exit
     
    123117      if (xyc .EQ. 1 .OR. yzc .EQ. 1) then
    124118         print(" ")
    125          print("Please select just one crossection (xyc=1 or xzc=1 or yzc=1)")
     119         print("Select just one crossection (xyc=1 or xzc=1 or yzc=1)")
    126120         print(" ")
    127121         exit
     
    131125      if (xyc .EQ. 1 .OR. xzc .EQ. 1) then
    132126         print(" ")
    133          print("Please select just one crossection (xyc=1 or xzc=1 or yzc=1)")
     127         print("Select just one crossection (xyc=1 or xzc=1 or yzc=1)")
    134128         print(" ")
    135129         exit
     
    139133   if (vector .NE. 0 .AND. vector .NE. 1) then
    140134      print(" ")
    141       print("Please set 'vector' to 0 or 1")
     135      print("Set 'vector' to 0 or 1")
    142136      print(" ")
    143137      exit
    144    end if   
     138   end if 
     139   
     140   if (norm_x .EQ. 0) then
     141      print(" ")
     142      print("Normalising with 0 is not allowed, 'norm_x' is set to 1.0")
     143      print(" ")
     144      norm_x = 1.0
     145   end if
     146   if (norm_y .EQ. 0) then
     147      print(" ")
     148      print("Normalising with 0 is not allowed, 'norm_y' is set to 1.0")
     149      print(" ")
     150      norm_y = 1.0
     151   end if
     152   if (norm_z .EQ. 0) then
     153      print(" ")
     154      print("Normalising with 0 is not allowed, 'norm_z' is set to 1.0")
     155      print(" ")
     156      norm_z = 1.0
     157   end if
    145158 
    146159   ; ***************************************************
    147160   ; open input file
    148161   ; ***************************************************
    149 
    150    f  = addfile( file_in, "r" )
    151 
    152    vNam  = getfilevarnames(f)
     162   
     163   file_in_1 = False
     164   if (isStrSubset(file_in, ".nc"))then
     165      start_f = -2
     166      end_f = -2
     167      file_in_1 = True     
     168   end if
     169
     170   if (start_f .EQ. -1)then
     171      print(" ")
     172      print("'start_f' must be one of the cyclic numbers (at least 0) of your input file(s)")
     173      print(" ") 
     174      exit
     175   end if
     176   if (end_f .EQ. -1)then
     177      print(" ")
     178      print("'end_f' must be one of the cyclic numbers (at least 0) of your input file(s)")
     179      print(" ") 
     180      exit
     181   end if
     182
     183   files=new(end_f-start_f+1,string)
     184
     185   if (file_in_1)then
     186      if (isfilepresent(file_in))then
     187         files(0)=file_in
     188      else
     189         print(" ")
     190         print("1st input file: '"+file_in+"' does not exist")
     191         print(" ")
     192         exit
     193      end if
     194   else   
     195      if (start_f .EQ. 0)then
     196         if (isfilepresent(file_in+".nc"))then
     197            files(0)=file_in+".nc"
     198            do i=1,end_f
     199               if (isfilepresent(file_in+"."+i+".nc"))then   
     200                  files(i)=file_in+"."+i+".nc"
     201               else
     202                  print(" ")
     203                  print("Input file: '"+file_in+"."+i+".nc' does not exist")
     204                  print(" ")
     205                  exit 
     206               end if       
     207            end do         
     208         else
     209            print(" ")
     210            print("Input file: '"+file_in+".nc' does not exist")
     211            print(" ")
     212            exit
     213         end if
     214      else
     215         do i=start_f,end_f
     216            if (isfilepresent(file_in+"."+i+".nc"))then   
     217               files(i-start_f)=file_in+"."+i+".nc"
     218            else
     219               print(" ")
     220               print("Input file: '"+file_in+"."+i+".nc' does not exist")
     221               print(" ")
     222               exit 
     223            end if
     224         end do
     225      end if
     226   end if
     227   
     228   f=addfiles(files,"r")
     229   f_att=addfile(files(0),"r")
     230   ListSetType(f,"cat")
     231
     232   vNam  = getfilevarnames(f_att)
    153233   print(" ")
    154234   print("Variables in input file:")
     
    225305   else
    226306      print(" ")
    227       print("Your input file: '"+file_in+"'")
    228       print("contains 3d or other data")
     307      print("Your input file contains 3d or other data")
    229308      print(" ")
    230309   end if
     
    242321
    243322   cs_res                          = True
     323   vecres                          = True
    244324   cs_res@gsnYAxisIrregular2Linear = True 
    245325 
     
    247327   cs_res@gsnFrame                = False
    248328   cs_res@gsnMaximize             = True
    249    cs_res@gsnPaperOrientation     = "portrait"
    250    cs_res@gsnPaperWidth           = 8.27
    251    cs_res@gsnPaperHeight          = 11.69
    252    cs_res@gsnPaperMargin          = 0.79
    253    cs_res@tmXBLabelFontHeightF   = .03
    254    cs_res@tmYLLabelFontHeightF   = .03
    255    cs_res@tiXAxisFontHeightF     = .03
    256    cs_res@tiYAxisFontHeightF     = .03
     329   
     330   cs_res@tmXBLabelFontHeightF   = font_size
     331   cs_res@tmYLLabelFontHeightF   = font_size
     332   cs_res@tiXAxisFontHeightF     = font_size
     333   cs_res@tiYAxisFontHeightF     = font_size
    257334   cs_res@tmXBMode                ="Automatic"
    258335   cs_res@tmYLMode                ="Automatic"
    259    cs_res@lgTitleFontHeightF     = .03
    260    cs_res@lgLabelFontHeightF     = .03
    261    cs_res@txFontHeightF          = .03
     336 
    262337   cs_res@cnLevelSelectionMode    = "ManualLevels"
     338   cs_res@lbLabelFontHeightF = font_size_legend
     339   cs_res@lbLabelStride = legend_label_stride
     340   
    263341
    264342   cs_resP = True
    265    cs_resP@txString               = f@title
     343   cs_resP@txString               = f_att@title
    266344   cs_resP@txFuncCode             = "~"                 
    267    cs_resP@txFontHeightF          = .02
    268    
     345   cs_resP@txFontHeightF          = 0.015       
    269346 
    270347   if ( mode .eq. "Fill" ) then
    271348      cs_res@cnFillOn             = True
    272349      cs_res@gsnSpreadColors      = True
    273       cs_res@cnFillMode           = fill_mode
    274       cs_res@lbOrientation        = "Vertical"         
     350      cs_res@cnFillMode           = fill_mode   
    275351      cs_res@cnLinesOn            = False       
    276352      cs_res@cnLineLabelsOn       = False
     
    280356      cs_res@cnFillOn             = True
    281357      cs_res@gsnSpreadColors      = True
    282       cs_res@cnFillMode           = fill_mode
    283       cs_res@lbOrientation        = "Vertical" 
     358      cs_res@cnFillMode           = fill_mode
    284359      cs_res@cnLinesOn            = True
    285360      cs_res@cnLineLabelsOn       = True
     
    290365   ; *********************************************
    291366
    292    t_all = f->time
     367   t_all = f[:]->time
    293368   nt = dimsizes(t_all)
    294369   delta_t = t_all(nt-1)/nt
     
    305380         print("'start_time_step' = "+ start_time_step +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
    306381         print(" ")
    307          print("Please select another 'start_time_step'")
     382         print("Select another 'start_time_step'")
    308383         print(" ")
    309384         exit
     
    313388         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
    314389         print(" ")
    315          print("Please select another 'start_time_step'")
     390         print("Select another 'start_time_step'")
    316391         print(" ")
    317392         exit
    318393      end if
    319394   end if
    320    do i=0,nt-1     
     395   do i=0,nt-1   
    321396      if (start_time_step .GE. (t_all(i)-delta_t/2)/3600 .AND. start_time_step .LT. (t_all(i)+delta_t/2)/3600)then
    322397         st=i
     
    329404      print("'start_time_step' = "+ start_time_step +"h is invalid")
    330405      print(" ")
    331       print("Please select another 'start_time_step'")
     406      print("Select another 'start_time_step'")
    332407      print(" ")
    333408      exit
     
    345420         print("'end_time_step' = "+end_time_step+ "h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
    346421         print(" ")
    347          print("Please select another 'end_time_step'")
     422         print("Select another 'end_time_step'")
    348423         print(" ")
    349424         exit
     
    353428         print("'end_time_step' = "+ end_time_step +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
    354429         print(" ")
    355          print("Please select another 'end_time_step'") 
     430         print("Select another 'end_time_step'") 
    356431         print(" ")
    357432         exit
     
    361436         print("'end_time_step' = "+ end_time_step +"h is lower than 'start_time_step' = "+start_time_step+"h")
    362437         print(" ")
    363          print("Please select another 'start_time_step' or 'end_time_step'")
     438         print("Select another 'start_time_step' or 'end_time_step'")
    364439         print(" ")
    365440         exit
     
    377452      print("'end_time_step' = "+ end_time_step +"h is invalid")
    378453      print(" ")
    379       print("Please select another 'end_time_step'")
     454      print("Select another 'end_time_step'")
    380455      print(" ")
    381456      exit
     
    401476      if (vec1 .EQ. "component1") then
    402477         print(" ")
    403          print("Please indicate Vector 1 ('vec1') for Vector-Plot or set 'vector' to 0")
     478         print("Indicate Vector 1 ('vec1') for Vector-Plot or set 'vector' to 0")
    404479         print(" ")
    405480         exit
     
    407482      if (vec2 .EQ. "component2") then
    408483         print(" ")
    409          print("Please indicate Vector 2 ('vec2') for Vector-Plot or set 'vector' to 0")
     484         print("Indicate Vector 2 ('vec2') for Vector-Plot or set 'vector' to 0")
    410485         print(" ")
    411486         exit
     
    424499      do varn=0,dim-1
    425500         if (vNam(varn) .eq. "xu" .OR. vNam(varn) .eq. "x")then   
    426             x_d     = f->$vNam(varn)$
     501            x_d     = f_att->$vNam(varn)$
    427502            xdim    = dimsizes(x_d)-1
    428503            delta_x = x_d(1)-x_d(0)
     
    432507      do varn=0,dim-1
    433508         if (vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "y")then   
    434             y_d     = f->$vNam(varn)$
     509            y_d     = f_att->$vNam(varn)$
    435510            ydim    = dimsizes(y_d)-1
    436511            delta_y = y_d(1)-y_d(0)
     
    440515      do varn=0,dim-1
    441516         if (vNam(varn) .eq. "zu_3d" .OR. vNam(varn) .eq. "zw_3d")then
    442             z_d     = f->$vNam(varn)$
     517            z_d     = f_att->$vNam(varn)$
    443518            zdim    = dimsizes(z_d)-1
    444519            delta_z = 0
     
    446521         else
    447522            if (vNam(varn) .eq. "zu_xy" .OR. vNam(varn) .eq. "zw_xy") then
    448                z_d     = f->$vNam(varn)$
     523               z_d     = f_att->$vNam(varn)$
    449524               zdim    = dimsizes(z_d)-1
    450525               delta_z = -1.d
     
    460535      do varn=0,dim-1
    461536         if (vNam(varn) .eq. "xu"  .OR. vNam(varn) .eq. "x") then
    462             x_d     = f->$vNam(varn)$
     537            x_d     = f_att->$vNam(varn)$
    463538            xdim    = dimsizes(x_d)-1
    464539            delta_x = x_d(1)-x_d(0)
     
    468543      do varn=0,dim-1   
    469544         if (vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "zu" .OR. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d") then
    470             z_d     = f->$vNam(varn)$
     545            z_d     = f_att->$vNam(varn)$
    471546            zdim    = dimsizes(z_d)-1
    472547            delta_z = z_d(1)-z_d(0)
     
    476551      do varn=0,dim-1
    477552         if (vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "y") then
    478             y_d     = f->$vNam(varn)$
     553            y_d     = f_att->$vNam(varn)$
    479554            ydim    = dimsizes(y_d)-1
    480555            delta_y = y_d(1)-y_d(0)
     
    482557         else
    483558            if (vNam(varn) .eq. "y_xz" .or. vNam(varn) .eq. "yv_xz") then
    484                y_d     = f->$vNam(varn)$
     559               y_d     = f_att->$vNam(varn)$
    485560               ydim    = dimsizes(y_d)-1
    486561               delta_y = -1.d
     
    496571      do varn=0,dim-1 
    497572         if (vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "y") then
    498             y_d     = f->$vNam(varn)$
     573            y_d     = f_att->$vNam(varn)$
    499574            ydim    = dimsizes(y_d)-1
    500575            delta_y = y_d(1)-y_d(0)
     
    504579      do varn=0,dim-1
    505580         if (vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "zu" .OR. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d") then
    506             z_d     = f->$vNam(varn)$
     581            z_d     = f_att->$vNam(varn)$
    507582            zdim    = dimsizes(z_d)-1
    508583            delta_z = z_d(1)-z_d(0)
     
    512587      do varn=0,dim-1
    513588         if (vNam(varn) .eq. "xu" .or. vNam(varn) .eq. "x")
    514             x_d     = f->$vNam(varn)$
     589            x_d     = f_att->$vNam(varn)$
    515590            xdim    = dimsizes(x_d)-1
    516591            delta_x = x_d(1)-x_d(0)
     
    518593         else
    519594            if (vNam(varn) .eq. "xu_yz" .or. vNam(varn) .eq. "x_yz" ) then
    520                x_d     = f->$vNam(varn)$
     595               x_d     = f_att->$vNam(varn)$
    521596               xdim    = dimsizes(x_d)-1
    522597               delta_x = -1.d
     
    848923      end do
    849924   end if
    850    
     925 
    851926   if( shape .eq. 1 ) then
    852927      if (xyc .EQ. 1)then
    853928         cs_res@vpWidthF    = (xe-xs)/(ye-ys)       
    854929         cs_res@vpHeightF   = 1
     930         vecres@vpWidthF    = (xe-xs)/(ye-ys)       
     931         vecres@vpHeightF   = 1
     932         if (xe-xs .GT. ye-ys)then
     933            cs_res@gsnPaperOrientation     = "landscape"
     934            vecres@gsnPaperOrientation     = "landscape"
     935            cs_res@lbOrientation = "Horizontal"   
     936         else
     937            cs_res@gsnPaperOrientation     = "portrait"
     938            vecres@gsnPaperOrientation     = "portrait"
     939            cs_res@lbOrientation = "Vertical"
     940         end if
    855941      end if
    856942      if (xzc .EQ. 1)then
    857943         cs_res@vpWidthF    = (xe-xs)/(delta_x*(ze-zs))       
    858944         cs_res@vpHeightF   = 1
     945         vecres@vpWidthF    = (xe-xs)/(delta_x*(ze-zs))       
     946         vecres@vpHeightF   = 1
     947         if (xe-xs .GT. (delta_x*(ze-zs)))then
     948            cs_res@gsnPaperOrientation     = "landscape"
     949            vecres@gsnPaperOrientation     = "landscape"
     950            cs_res@lbOrientation = "Horizontal"   
     951         else
     952            cs_res@gsnPaperOrientation     = "portrait"
     953            vecres@gsnPaperOrientation     = "portrait"
     954            cs_res@lbOrientation = "Vertical"
     955         end if
    859956      end if
    860957      if (yzc .EQ. 1)then
    861958         cs_res@vpWidthF    = (ye-ys)/(delta_y*(ze-zs))       
    862959         cs_res@vpHeightF   = 1
    863       end if
    864    end if
    865    
     960         vecres@vpWidthF    = (ye-ys)/(delta_y*(ze-zs))       
     961         vecres@vpHeightF   = 1
     962         if (ye-ys .GT. (delta_y*(ze-zs)))then
     963            cs_res@gsnPaperOrientation     = "landscape"
     964            vecres@gsnPaperOrientation     = "landscape"
     965            cs_res@lbOrientation = "Horizontal"   
     966         else
     967            cs_res@gsnPaperOrientation     = "portrait"
     968            vecres@gsnPaperOrientation     = "portrait"
     969            cs_res@lbOrientation = "Vertical"
     970         end if
     971      end if
     972   end if
     973
    866974   delete(xs)
    867975   delete(xe)   
     
    874982   ye=yend
    875983
     984   if (xyc .EQ. 1) then
     985      d=(ye-ys+1)/(major_ticks_y-1)
     986      e=(xe-xs+1)/(major_ticks_x-1)
     987      array_yl       =new(major_ticks_y,integer)
     988      array_yl_labels=new(major_ticks_y,double)
     989      array_minor_yl =new((major_ticks_y-1)*4,double)
     990      array_xb       =new(major_ticks_x,integer)
     991      array_xb_labels=new(major_ticks_x,double)
     992      array_minor_xb =new((major_ticks_x-1)*4,double)
     993      array_yl(0)=ys
     994      array_xb(0)=xs
     995      array_yl_labels(0)=y_d(ys)
     996      array_xb_labels(0)=x_d(xs)
     997      do ar=1,major_ticks_y-1
     998         array_yl(ar)=d*(ar-1)+d-1
     999         array_yl_labels(ar) = y_d(array_yl(ar))
     1000         if (ar .GT. 0)
     1001            do min_ar=0,3
     1002               array_minor_yl(4*(ar-1)+min_ar)= int2dble(array_yl(ar-1))+int2dble(array_yl(ar)-array_yl(ar-1))/5*(min_ar+1)
     1003            end do
     1004         end if 
     1005      end do
     1006      do br=1,major_ticks_x-1
     1007         array_xb(br)=e*(br-1)+e-1
     1008         array_xb_labels(br) = x_d(array_xb(br))
     1009         if (br .GT. 0)
     1010            do min_br=0,3
     1011               array_minor_xb(4*(br-1)+min_br)= int2dble(array_xb(br-1))+int2dble(array_xb(br)-array_xb(br-1))/5*(min_br+1)
     1012            end do
     1013         end if
     1014      end do
     1015   end if
     1016 
     1017   if (xzc .EQ. 1) then
     1018      d=(ze-zs+1)/(major_ticks_y-1)
     1019      e=(xe-xs+1)/(major_ticks_x-1)
     1020      array_yl       =new(major_ticks_y,integer)
     1021      array_yl_labels=new(major_ticks_y,double)
     1022      array_minor_yl =new((major_ticks_y-1)*4,double)
     1023      array_xb       =new(major_ticks_x,integer)
     1024      array_xb_labels=new(major_ticks_x,double)
     1025      array_minor_xb =new((major_ticks_x-1)*4,double)
     1026      array_yl(0)=zs
     1027      array_xb(0)=xs
     1028      array_yl_labels(0)=z_d(zs)
     1029      array_xb_labels(0)=x_d(xs)
     1030      do ar=1,major_ticks_y-1
     1031         array_yl(ar)=d*(ar-1)+d-1
     1032         array_yl_labels(ar) = z_d(array_yl(ar))
     1033         if (ar .GT. 0)
     1034            do min_ar=0,3
     1035               array_minor_yl(4*(ar-1)+min_ar)= int2dble(array_yl(ar-1))+int2dble(array_yl(ar)-array_yl(ar-1))/5*(min_ar+1)
     1036            end do
     1037         end if 
     1038      end do
     1039      do br=1,major_ticks_x-1
     1040         array_xb(br)=e*(br-1)+e-1
     1041         array_xb_labels(br) = x_d(array_xb(br))
     1042         if (br .GT. 0)
     1043            do min_br=0,3
     1044               array_minor_xb(4*(br-1)+min_br)= int2dble(array_xb(br-1))+int2dble(array_xb(br)-array_xb(br-1))/5*(min_br+1)
     1045            end do
     1046         end if
     1047      end do
     1048   end if
     1049
     1050   if (yzc .EQ. 1) then
     1051      d=(ze-zs+1)/(major_ticks_y-1)
     1052      e=(ye-ys+1)/(major_ticks_x-1)
     1053      array_yl       =new(major_ticks_y,integer)
     1054      array_yl_labels=new(major_ticks_y,double)
     1055      array_minor_yl =new((major_ticks_y-1)*4,double)
     1056      array_xb       =new(major_ticks_x,integer)
     1057      array_xb_labels=new(major_ticks_x,double)
     1058      array_minor_xb =new((major_ticks_x-1)*4,double)
     1059      array_yl(0)=zs
     1060      array_xb(0)=ys
     1061      array_yl_labels(0)=z_d(zs)
     1062      array_xb_labels(0)=y_d(ys)
     1063      do ar=1,major_ticks_y-1
     1064         array_yl(ar)=d*(ar-1)+d-1
     1065         array_yl_labels(ar) = y_d(array_yl(ar))
     1066         if (ar .GT. 0)
     1067            do min_ar=0,3
     1068               array_minor_yl(4*(ar-1)+min_ar)= int2dble(array_yl(ar-1))+int2dble(array_yl(ar)-array_yl(ar-1))/5*(min_ar+1)
     1069            end do
     1070         end if 
     1071      end do
     1072      do br=1,major_ticks_x-1
     1073         array_xb(br)=e*(br-1)+e-1
     1074         array_xb_labels(br) = x_d(array_xb(br))
     1075         if (br .GT. 0)
     1076            do min_br=0,3
     1077               array_minor_xb(4*(br-1)+min_br)= int2dble(array_xb(br-1))+int2dble(array_xb(br)-array_xb(br-1))/5*(min_br+1)
     1078            end do
     1079         end if
     1080      end do
     1081   end if
     1082
     1083   if (axes_explicit .EQ. 1)then
     1084      cs_res@tmYLMode = "Explicit"
     1085      cs_res@tmXBMode = "Explicit"
     1086      cs_res@tmYLValues = array_yl
     1087      if (xyc .EQ. 1)then
     1088         cs_res@tmYLLabels = array_yl_labels/norm_y
     1089         cs_res@tmXBLabels = array_xb_labels/norm_x
     1090         if (norm_x .NE. 1.)then
     1091            cs_res@tiXAxisString = "x ["+unit_x+"]"
     1092         else
     1093            cs_res@tiXAxisString = "x [m]"
     1094         end if
     1095         if (norm_y .NE. 1.)then
     1096            cs_res@tiYAxisString = "y ["+unit_y+"]"
     1097         else
     1098            cs_res@tiYAxisString = "y [m]"
     1099         end if   
     1100      end if
     1101      if (xzc .EQ. 1)then
     1102         cs_res@tmYLLabels = array_yl_labels/norm_z
     1103         cs_res@tmXBLabels = array_xb_labels/norm_x
     1104         if (norm_x .NE. 1.)then
     1105            cs_res@tiXAxisString = "x ["+unit_x+"]"
     1106         else
     1107            cs_res@tiXAxisString = "x [m]"
     1108         end if
     1109         if (norm_z .NE. 1.)then
     1110            cs_res@tiYAxisString = "z ["+unit_z+"]"
     1111         else
     1112            cs_res@tiYAxisString = "z [m]"
     1113         end if
     1114      end if
     1115      if (yzc .EQ. 1)then
     1116         cs_res@tmYLLabels = array_yl_labels/norm_z
     1117         cs_res@tmXBLabels = array_xb_labels/norm_y
     1118         if (norm_y .NE. 1.)then
     1119            cs_res@tiXAxisString = "y ["+unit_y+"]"
     1120         else
     1121            cs_res@tiXAxisString = "y [m]"
     1122         end if
     1123         if (norm_z .NE. 1.)then
     1124            cs_res@tiYAxisString = "z ["+unit_z+"]"
     1125         else
     1126            cs_res@tiYAxisString = "z [m]"
     1127         end if
     1128      end if
     1129      cs_res@tmXBValues = array_xb     
     1130      cs_res@tmYLMinorValues = array_minor_yl
     1131      cs_res@tmXBMinorValues = array_minor_xb
     1132   else
     1133      if (axes_explicit .EQ. 0)then 
     1134         cs_res@tmYLMinorPerMajor = 4
     1135         cs_res@tmXBMinorPerMajor = 4
     1136      else
     1137         print(" ")
     1138         print("'axes_explicit' is invalid and set to 0")
     1139         print(" ")
     1140         axes_explicit = 0
     1141         cs_res@tmYLMinorPerMajor = 4
     1142         cs_res@tmXBMinorPerMajor = 4
     1143      end if
     1144      if (xyc .EQ. 1)then
     1145         cs_res@tiXAxisString = "x [gridpoints]"
     1146         cs_res@tiYAxisString = "y [gridpoints]"
     1147      end if
     1148      if (xzc .EQ. 1)then
     1149         cs_res@tiXAxisString = "x [gridpoints]"
     1150         cs_res@tiYAxisString = "z [gridpoints]"
     1151      end if
     1152      if (yzc .EQ. 1)then
     1153         cs_res@tiXAxisString = "y [gridpoints]"
     1154         cs_res@tiYAxisString = "z [gridpoints]"
     1155      end if
     1156   end if
     1157
    8761158   if (xyc .EQ. 1 .OR. xzc .EQ.1)then
    8771159      if (xe .EQ. xs+1) then
     
    9161198
    9171199   MinVal = new(dim,float)
    918    MaxVal = new(dim,float)
     1200   MaxVal = new(dim,float)
     1201   unit   = new(dim,string)
    9191202
    9201203   ; ****************************************************
     
    9801263
    9811264         if (xyc .EQ. 1) then
    982             data(varn,:,:,:,:)=f->$vNam(varn)$(:,zs:ze,ys:ye,xs:xe)     
     1265            temp = f[:]->$vNam(varn)$
     1266            data_att = f_att->$vNam(varn)$
     1267            data(varn,:,:,:,:)=temp(:,zs:ze,ys:ye,xs:xe)               
    9831268         end if
    9841269         if ( xzc .eq. 1 ) then
    985             data(varn,:,:,:,:)=f->$vNam(varn)$(:,zs:ze,ys:ye,xs:xe)
     1270            temp = f[:]->$vNam(varn)$
     1271            data_att = f_att->$vNam(varn)$
     1272            data(varn,:,:,:,:)=temp(:,zs:ze,ys:ye,xs:xe)
    9861273         end if
    9871274         if ( yzc .eq. 1) then
    988             data(varn,:,:,:,:)=f->$vNam(varn)$(:,zs:ze,ys:ye,xs:xe)
     1275            temp = f[:]->$vNam(varn)$
     1276            data_att = f_att->$vNam(varn)$
     1277            data(varn,:,:,:,:)=temp(:,zs:ze,ys:ye,xs:xe)
    9891278         end if
    9901279         if (check_vec1) then
     
    10031292         MinVal(varn) = min(data(varn,:,:,:,:))
    10041293         MaxVal(varn) = max(data(varn,:,:,:,:))
     1294         
     1295         unit(varn) = data_att@units
    10051296
    10061297      end if
     
    10751366   gsn_define_colormap(wks_ps,"rainbow+white")
    10761367
    1077    plot=new((/no_time*no_layer*no_var/),graphic)
    1078  
     1368   if (vector .EQ. 1 .AND. plotvec .EQ. "plotvec") then
     1369      plot=new((/no_time*no_layer*no_var+no_time*no_layer/),graphic)
     1370   else
     1371      plot=new((/no_time*no_layer*no_var/),graphic)
     1372   end if
     1373
    10791374   page = 0
    10801375   n=0
     
    10901385      do lo = los, loe                                         
    10911386         do li = lis, lie
    1092             level = "=" + data&z(lo) + "m"       
     1387            if (xyc .EQ. 1)then
     1388               if (sort .EQ. "time")then
     1389                  level = "z=" + z_d(lo) + "m"
     1390               else
     1391                  level = "z=" + z_d(li) + "m"
     1392               end if
     1393            end if
     1394            if (xzc .EQ. 1)then
     1395               if (sort .EQ. "time")then
     1396                  level = "y=" + y_d(lo) + "m"
     1397               else
     1398                  level = "y=" + y_d(li) + "m"
     1399               end if
     1400            end if
     1401            if (yzc .EQ. 1)then
     1402               if (sort .EQ. "time")then
     1403                  level = "x=" + x_d(lo) + "m"
     1404               else
     1405                  level = "x=" + x_d(li) + "m"
     1406               end if
     1407            end if               
    10931408            vecres                  = True            ; vector only resources
    10941409            vecres@gsnDraw          = False           ; don't draw
     
    10981413            vecres@vcRefLengthF     = 0.05            ; define length of vec ref
    10991414            vecres@gsnRightString   = "Vector plot of "+vec1+" and "+vec2
    1100             vecres@gsnLeftString = "t=" + data&t(li) +"s  z"+level
    1101             vecres@tiXAxisString    = " "                                               
    1102             plot(n) = gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     1415            vecres@tmXBLabelFontHeightF   = font_size
     1416            vecres@tmYLLabelFontHeightF   = font_size
     1417            vecres@tiXAxisFontHeightF     = font_size
     1418            vecres@tiYAxisFontHeightF     = font_size
     1419            if (sort .EQ. "time")then
     1420               vecres@gsnLeftString = "t=" + decimalPlaces(t_all(li)/3600,2,True) +"h   "+level
     1421            else
     1422               vecres@gsnLeftString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) +"h   "+level
     1423            end if
     1424            vecres@tiXAxisString    = " "
     1425            if (xyc .EQ. 1)then 
     1426               if (sort .EQ. "time")then                                         
     1427                  plot(n) = gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     1428               else
     1429                  plot(n) = gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     1430               end if
     1431            end if
     1432            if (xzc .EQ. 1) then
     1433               if (sort .EQ. "time")then
     1434                  plot(n) = gsn_csm_vector(wks_ps,vect1(li,:,lo,:),vect2(li,:,lo,:),vecres)
     1435               else
     1436                  plot(n) = gsn_csm_vector(wks_ps,vect1(lo,:,li,:),vect2(lo,:,li,:),vecres)
     1437               end if
     1438            end if
     1439            if (yzc .EQ. 1) then
     1440               if (sort .EQ. "time")then
     1441                  plot(n) = gsn_csm_vector(wks_ps,vect1(li,:,:,lo),vect2(li,:,:,lo),vecres)
     1442               else
     1443                  plot(n) = gsn_csm_vector(wks_ps,vect1(lo,:,:,li),vect2(lo,:,:,li),vecres)
     1444               end if
     1445            end if
    11031446            n=n+1
    11041447         end do
     
    11231466   
    11241467      if(check) then
    1125    
     1468
    11261469         space=(MaxVal(varn)-MinVal(varn))/24
    11271470 
     
    11441487
    11451488               if ( xyc .eq. 1 ) then
    1146                
    1147                   cs_res@tiXAxisString = "x [m]"
    1148                   cs_res@tiYAxisString = "y [m]"
     1489         
    11491490                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
     1491                  cs_res@gsnRightString = unit(varn)
    11501492                 
    11511493                  if ( sort .eq. "time" ) then
    1152                      if ( data&z(lo) .eq. -1)then
     1494                     if ( z_d(lo) .eq. -1)then
    11531495                        if (delta_z .EQ. -1) then
    11541496                           level = "-average"
    11551497                        else
    1156                            level = "=" + data&z(lo) + "m"
     1498                           level = "=" + z_d(lo) + "m"
    11571499                        end if
    11581500                     else
    1159                         level = "=" + data&z(lo) + "m"
     1501                        level = "=" + z_d(lo) + "m"
    11601502                     end if
    11611503                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) +"h  z"+level             
     
    11771519                 
    11781520                  if ( sort .eq. "layer" ) then
    1179                      if (data&z(li) .eq. -1) then
     1521                     if (z_d(li) .eq. -1) then
    11801522                        if (delta_z .EQ. -1) then
    11811523                           level = "-average"
    11821524                        else
    1183                            level = "=" + data&z(li) + "m"
     1525                           level = "=" + z_d(li) + "m"
    11841526                        end if
    11851527                     else
    1186                         level = "=" + data&z(li) + "m"
     1528                        level = "=" + z_d(li) + "m"
    11871529                     end if
    11881530                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  z"+ level               
     
    12091551
    12101552               if ( xzc .eq. 1 ) then
    1211        
    1212                   cs_res@tiXAxisString   = "x [m]"
    1213                   cs_res@tiYAxisString   = "z [m]"
     1553                 
    12141554                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
    12151555               
    12161556                  if ( sort .eq. "time" ) then
    1217                      if ( data&y(lo) .eq. -1 ) then
     1557                     if ( y_d(lo) .eq. -1 ) then
    12181558                        level = "-average"
    12191559                     else
    1220                         level = "=" + data&y(lo) + "m"
     1560                        level = "=" + y_d(lo) + "m"
    12211561                     end if
    1222                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "s  y"+ level
     1562                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "h  y"+ level
    12231563                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,lo,:),cs_res)
    12241564                     if (vector .EQ. 1 .AND. check_vecp) then
     
    12321572                        vecres@gsnLeftString    = " "             ; turn off left string
    12331573                        vecres@tiXAxisString    = " "   
    1234                         plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     1574                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,:,lo,:),vect2(li,:,lo,:),vecres)
    12351575                        overlay(plot(n), plot_vec)
    12361576                     end if
     
    12381578
    12391579                  if ( sort .eq. "layer" ) then
    1240                      if ( data&y(li) .eq. -1 ) then
     1580                     if ( y_d(li) .eq. -1 ) then
    12411581                        level = "-average"
    12421582                     else
    1243                         level = "=" + data&y(li) + "m"
     1583                        level = "=" + y_d(li) + "m"
    12441584                     end if
    1245                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "s  y"+ level
     1585                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  y"+ level
    12461586                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,li,:),cs_res)
    12471587                     if (vector .EQ. 1 .AND. check_vecp) then
     
    12551595                        vecres@gsnLeftString    = " "             ; turn off left string
    12561596                        vecres@tiXAxisString    = " "   
    1257                         plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     1597                        plot_vec=gsn_csm_vector(wks_ps,vect1(lo,:,li,:),vect2(lo,:,li,:),vecres)
    12581598                        overlay(plot(n), plot_vec)
    12591599                     end if
     
    12661606
    12671607               if ( yzc .eq. 1 ) then
    1268                
    1269                   cs_res@tiXAxisString   = "y [m]"
    1270                   cs_res@tiYAxisString   = "z [m]"
     1608                                 
    12711609                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
    12721610
    12731611                  if ( sort .eq. "time" ) then
    1274                      if ( data&x(lo) .eq. -1 ) then
     1612                     if ( x_d(lo) .eq. -1 ) then
    12751613                        level = "-average"
    12761614                     else
    1277                         level = "=" + data&x(lo) + "m"
     1615                        level = "=" + x_d(lo) + "m"
    12781616                     end if
    1279                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "s  x"+ level
     1617                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "h  x"+ level
    12801618                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,:,lo),cs_res)
    12811619                     if (vector .EQ. 1 .AND. check_vecp) then
     
    12891627                        vecres@gsnLeftString    = " "             ; turn off left string
    12901628                        vecres@tiXAxisString    = " "   
    1291                         plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
     1629                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,:,:,lo),vect2(li,:,:,lo),vecres)
    12921630                        overlay(plot(n), plot_vec)
    12931631                     end if
     
    12951633
    12961634                  if ( sort .eq. "layer" ) then
    1297                      if ( data&x(li) .eq. -1 ) then
     1635                     if ( x_d(li) .eq. -1 ) then
    12981636                        level = "-average"
    12991637                     else
    1300                         level = "=" + data&x(li) + "m"
     1638                        level = "=" + x_d(li) + "m"
    13011639                     end if
    1302                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "s  x"+ level
     1640                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  x"+ level
    13031641                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,:,li),cs_res)
    13041642                     if (vector .EQ. 1 .AND. check_vecp)then
     
    13121650                        vecres@gsnLeftString    = " "             ; turn off left string
    13131651                        vecres@tiXAxisString    = " "   
    1314                         plot_vec=gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
     1652                        plot_vec=gsn_csm_vector(wks_ps,vect1(lo,:,:,li),vect2(lo,:,:,li),vecres)
    13151653                        overlay(plot(n), plot_vec)
    13161654                     end if
    13171655                  end if
    13181656               end if         
    1319                n=n+1   
     1657               n=n+1 
    13201658            end do     
    13211659         end do 
     
    13341672         print(" ")
    13351673      else
    1336          do np = 0,no_layer*no_time*(no_var+1)-1,no_lines*no_columns   
    1337             if ( np + no_lines*no_columns .gt. (no_layer*no_time*(no_var+1))-1) then
    1338                gsn_panel(wks_ps, plot(np:(no_layer*no_time*(no_var+1))-1),(/no_lines,no_columns/),cs_resP)
     1674         do np = 0,no_layer*no_time*(no_var+1)-1,no_rows*no_columns   
     1675            if ( np + no_rows*no_columns .gt. (no_layer*no_time*(no_var+1))-1) then
     1676               gsn_panel(wks_ps, plot(np:(no_layer*no_time*(no_var+1))-1),(/no_rows,no_columns/),cs_resP)
    13391677            else
    1340                gsn_panel(wks_ps, plot(np:np+no_lines*no_columns-1),(/no_lines,no_columns/),cs_resP)
     1678               gsn_panel(wks_ps, plot(np:np+no_rows*no_columns-1),(/no_rows,no_columns/),cs_resP)
    13411679            end if
    13421680         end do
    13431681      end if
    1344    else         
     1682   else       
    13451683      if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
    13461684         gsn_panel(wks_ps,plot(0:(no_time*no_layer*no_var)-1),(/no_var,no_layer*no_time/),cs_resP)
     
    13491687         print(" ")
    13501688      else
    1351          do np = 0,no_layer*no_time*no_var-1,no_lines*no_columns   
    1352             if ( np + no_lines*no_columns .gt. (no_layer*no_time*no_var)-1) then
    1353                gsn_panel(wks_ps, plot(np:(no_layer*no_time*no_var)-1),(/no_lines,no_columns/),cs_resP)
     1689         do np = 0,no_layer*no_time*no_var-1,no_rows*no_columns   
     1690            if ( np + no_rows*no_columns .gt. (no_layer*no_time*no_var)-1) then
     1691               gsn_panel(wks_ps, plot(np:(no_layer*no_time*no_var)-1),(/no_rows,no_columns/),cs_resP)
    13541692            else
    1355                gsn_panel(wks_ps, plot(np:np+no_lines*no_columns-1),(/no_lines,no_columns/),cs_resP)
     1693               gsn_panel(wks_ps, plot(np:np+no_rows*no_columns-1),(/no_rows,no_columns/),cs_resP)
    13561694            end if
    13571695         end do
Note: See TracChangeset for help on using the changeset viewer.