Index: palm/trunk/SCRIPTS/NCL/profiles.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 161)
+++ palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 162)
@@ -107,7 +107,7 @@
    if ( .not. isvar("over") ) then     		        ; switches overlaying plots on
       over = 0
-      if (stringtointeger(parameter(73)) .NE. 0) then
-         over = stringtointeger(parameter(73))
-         if (stringtointeger(parameter(73)) .NE. 1) then
+      if (stringtointeger(parameter(37)) .NE. 0) then
+         over = stringtointeger(parameter(37))
+         if (stringtointeger(parameter(37)) .NE. 1) then
             print(" ")
             print("Please set 'over' to 0 or 1")
@@ -456,9 +456,14 @@
       end do
    end if
- 
-   dimz  = dimsizes(z_w)
-   dimz  = dimsizes(z_u)
+   if (isvar("z_u") ) then 
+      dimz  = dimsizes(z_u)
+   else
+      if (isvar("z_w"))then 
+         dimz  = dimsizes(z_w)
+      end if
+   end if
    t_all = f->time
    nt    = dimsizes(t_all)
+   delta_t=t_all(nt-1)/nt
  
    ; ****************************************************	
@@ -467,36 +472,53 @@
 
    if ( .not. isvar("start_time_step") ) then   	
-      start_time_step = 1
-      if (parameter(13) .NE. "1") then
-         if (parameter(13) .LE. "1")
+      start_time_step=t_all(1)/3600
+      if (parameter(13) .NE. "t(0)") then
+         if (stringtodouble(parameter(13)) .GT. t_all(nt-1)/3600)
             print(" ")
-            print("Begin at least with time step 2")
+            print("'start_time_step' = "+ parameter(13) +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
+            print(" ")
+            print("Please select another 'start_time_step'")
             print(" ")
             exit
          end if
-         if (stringtointeger(parameter(13)) .GE. nt)
+         if (stringtofloat(parameter(13)) .LE. t_all(0)/3600)
             print(" ")
-            print("'start_time_step' = "+ parameter(13) +" is greater than available time steps = " + (nt-1))
+            print("'start_time_step' = "+ parameter(13) +"h is equal or lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
+            print(" ")
+            print("Please start profiles at least with second time step = "+t_all(1)+"s = "+t_all(1)/3600+"h") 
             print(" ")
             exit
          end if
-         start_time_step = stringtointeger(parameter(13))-1  
+         start_time_step=stringtodouble(parameter(13)) 
       end if
    else 
-      if (start_time_step .LE. 0)
+      if (start_time_step .GT. t_all(nt-1)/3600)
          print(" ")
-         print("Begin at least with time step 1")
+         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")
+         print(" ")
+         print("Please select another 'start_time_step'")
          print(" ")
          exit
       end if
-      if (start_time_step .GE. nt)
+      if (start_time_step .LE. t_all(0)/3600)
          print(" ")
-         print("'start_time_step' = "+ start_time_step +" is greater than available time steps = " + (nt-1))
+         print("'start_time_step' = "+ start_time_step +"h is equal or lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
+         print(" ")
+         print("Please start profiles at least with second time step = "+t_all(1)+"s = "+t_all(1)/3600+"h")
          print(" ")
          exit
       end if
-      start_time_step = start_time_step - 1 
    end if
-
+   start_time_step = start_time_step*3600
+   if (start_time_step .GT. t_all(0) .AND. start_time_step .LT. t_all(1)+delta_t/2)then
+      st=1
+   end if
+   do i=2,nt-1     
+      if (start_time_step .GE. t_all(i)-delta_t/2 .AND. start_time_step .LT. t_all(i)+delta_t/2)then
+         st=i
+         break
+      end if
+   end do
+  
    ; ****************************************************
    ; end of time step and different types of mistakes that could be done
@@ -504,47 +526,57 @@
 
    if ( .not. isvar("end_time_step") ) then     	
-      end_time_step = nt-1
-      if (parameter(15) .NE. "nt") then
-         if (parameter(15) .LE. "0")
-            print(" ") 
-            print("'end_time_step' = "+parameter(15)+ " is too small; 'end_time_step' should be at least 1 ")
-            print(" ") 
-            exit
-         end if
-         if (stringtointeger(parameter(15)) .GE. nt)
+      end_time_step = t_all(nt-1)/3600
+      if (parameter(15) .NE. "t(end)") then
+         if (stringtodouble(parameter(15)) .GT. t_all(nt-1)/3600)
             print(" ")
-            print("'end_time_step' = "+ parameter(15) +" is greater than available time steps = " + (nt-1))
+            print("'end_time_step' = "+ parameter(15) +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
+            print(" ")
+            print("Please select another 'end_time_step'")  
             print(" ")
             exit
          end if
-         if (stringtointeger(parameter(15)) .LT. stringtointeger(parameter(13)) )
+         if (stringtodouble(parameter(15)) .LT. start_time_step/3600)
             print(" ")
-            print("'end_time_step' = "+ parameter(15) +" is lower than 'start_time_step' = "+parameter(13))
+            print("'end_time_step' = "+ parameter(15) +"h is lower than 'start_time_step' = "+parameter(13)+"h")
+            print(" ")
+            print("Please select another 'start_time_step' or 'end_time_step'")
             print(" ")
             exit
          end if
-         end_time_step = stringtointeger(parameter(15))  
+         end_time_step = stringtodouble(parameter(15))
       end if    
    else
-      if (end_time_step .LE. 0)
+      if (end_time_step .GT. t_all(nt-1)/3600)
          print(" ")
-         print("'end_time_step' = "+end_time_step+ " is too small; 'end_time_step' should be at least 1 ")
+         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")
+         print(" ")
+         print("Please select another 'end_time_step'")  
          print(" ")
          exit
       end if
-      if (end_time_step .GE. nt)
+      if (end_time_step .LT. start_time_step/3600)
          print(" ")
-         print("'end_time_step' = "+ end_time_step +" is greater than available time steps = "+(nt-1))
+         print("'end_time_step' = "+ end_time_step +"h is lower than 'start_time_step' = "+start_time_step+"h")
+         print(" ")
+         print("Please select another 'start_time_step' or 'end_time_step'")
          print(" ")
          exit
       end if
-      if (end_time_step .LT. start_time_step)
-            print(" ")
-            print("'end_time_step' = "+end_time_step +" is lower than 'start_time_step' = "+start_time_step)
-            print(" ")
-            exit
+   end if
+   end_time_step = end_time_step*3600
+   if (end_time_step .GT. t_all(0) .AND. end_time_step .LT. t_all(1)+delta_t/2)then
+      et=1
+   end if
+   do i=2,nt-1     
+      if (end_time_step .GE. t_all(i)-delta_t/2 .AND. end_time_step .LT. t_all(i)+delta_t/2)then
+         et=i
+         break
       end if
-      end_time_step = end_time_step - 1
-   end if
+   end do 
+
+   delete(start_time_step)
+   start_time_step=round(st,3)
+   delete(end_time_step)
+   end_time_step=round(et,3)
 
    ; ****************************************************
@@ -557,5 +589,5 @@
    end do
    
-   np = end_time_step-start_time_step  
+   np = end_time_step-start_time_step+1  
    if ( black .eq. 0 ) then
       res=True      
@@ -887,4 +919,5 @@
  
    n_o=0
+   count_var=0
    do varn = 0,dim-1 
         
@@ -908,5 +941,4 @@
          com=isStrSubset(c_var,","+vNam(varn)+"," )      
          if (com)                       
-            check = False
             data(varn,:,:) = temp(start_time_step:end_time_step,0:dimz-1)
             unit(varn) = temp@units
@@ -919,5 +951,4 @@
             mini(n_o)=min(data(varn,:,:))
             maxi(n_o)=max(data(varn,:,:)) 
-            varn=varn+1
             n_o=n_o+1
          end if
@@ -925,5 +956,6 @@
 
       if(check) then
-               
+         count_var=count_var+1
+     
          z = f->$vNam(varn+1)$
   
@@ -935,7 +967,23 @@
             res@gsnRightString     = unit(varn)
             res@trYMinF            = min_z
-            res@trYMaxF            = max_z  
-            res@trXMinF            = min(data(varn,:,:))
-            res@trXMaxF            = max(data(varn,:,:))        
+            res@trYMaxF            = max_z 
+            if (.not. isvar("xs")) then 
+               if (parameter(63) .NE. "x0") then
+                  res@trXMinF = stringtofloat(parameter(63))
+               else
+                  res@trXMinF            = min(data(varn,:,:))
+               end if
+            else 
+               res@trXMinF            = xs
+            end if
+            if (.not. isvar("xe")) then 
+               if (parameter(65) .NE. "xdim") then
+                  res@trXMaxF = stringtofloat(parameter(65))
+               else
+                  res@trXMaxF            = max(data(varn,:,:)) 
+               end if
+            else 
+               res@trXMaxF            = xe  
+            end if                     
             plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)  
          end if       
@@ -950,6 +998,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniu
-                  res@trXMaxF            = maxiu                  
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniu
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiu 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if                
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)  
                end if
@@ -964,6 +1028,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniv
-                  res@trXMaxF            = maxiv                   
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniv
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiv 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if                
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
                end if  
@@ -978,6 +1058,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniw
-                  res@trXMaxF            = maxiw                   
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniw
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiw 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if           
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if   
@@ -993,6 +1089,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minipt
-                  res@trXMaxF            = maxipt
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minipt
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxipt 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if  
@@ -1007,6 +1119,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minivpt
-                  res@trXMaxF            = maxivpt 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minivpt
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxivpt 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
                end if 
@@ -1021,6 +1149,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minilpt
-                  res@trXMaxF            = maxilpt 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minilpt
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxilpt 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if 
@@ -1036,6 +1180,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniq
-                  res@trXMaxF            = maxiq 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minilq
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxilq 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if
@@ -1050,6 +1210,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniqv
-                  res@trXMaxF            = maxiqv
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minilqv
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxilqv 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
                end if
@@ -1064,54 +1240,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniql
-                  res@trXMaxF            = maxiql 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "rho") then                
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:))
-                  plot_q = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:)) 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "s") then                
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:))
-                  plot_s = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:)) 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "sa") then                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:)) 
-                  plot_sa = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:))  
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniql
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiql 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if
@@ -1127,6 +1271,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minie
-                  res@trXMaxF            = maxie 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minie
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxie 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if 
@@ -1141,6 +1301,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minies
-                  res@trXMaxF            = maxies
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minies
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxies 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
                end if
@@ -1156,6 +1332,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minikm
-                  res@trXMaxF            = maxikm
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minikm
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxikm 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if 
@@ -1170,23 +1362,23 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minikh
-                  res@trXMaxF            = maxikh 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minikh
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxikh 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "l") then                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:))
-                  plot_l = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:)) 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if
             end if
@@ -1201,6 +1393,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpup
-                  res@trXMaxF            = maxiwpup
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpup
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpup 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1215,6 +1423,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsus
-                  res@trXMaxF            = maxiwsus 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsus
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsus 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1229,6 +1453,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwu
-                  res@trXMaxF            = maxiwu
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwu
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwu 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1244,6 +1484,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpvp
-                  res@trXMaxF            = maxiwpvp
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpvp
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpvp 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1258,6 +1514,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsvs
-                  res@trXMaxF            = maxiwsvs 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsvs
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsvs 
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1272,6 +1544,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwv
-                  res@trXMaxF            = maxiwv 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwv
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwv
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1287,6 +1575,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpptp
-                  res@trXMaxF            = maxiwpptp 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpptp
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpptp
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1301,6 +1605,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwspts
-                  res@trXMaxF            = maxiwspts 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwspts
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwspts
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1315,6 +1635,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpt
-                  res@trXMaxF            = maxiwpt 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpt
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpt
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1330,6 +1666,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsptsBC
-                  res@trXMaxF            = maxiwsptsBC 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsptsBC
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsptsBC
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if 
@@ -1344,6 +1696,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwptBC
-                  res@trXMaxF            = maxiwptBC 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwptBC
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwptBC
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1359,6 +1727,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpvptp
-                  res@trXMaxF            = maxiwpvptp 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpvptp
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpvptp
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1373,6 +1757,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsvpts
-                  res@trXMaxF            = maxiwsvpts 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsvpts
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsvpts
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1387,6 +1787,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwvpt
-                  res@trXMaxF            = maxiwvpt 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwvpt
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwvpt
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1402,6 +1818,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpqp
-                  res@trXMaxF            = maxiwpqp 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpqp
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpqp
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1416,6 +1848,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsqs
-                  res@trXMaxF            = maxiwsqs 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsqs
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsqs
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1430,6 +1878,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwq
-                  res@trXMaxF            = maxiwq 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwq
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwq
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1445,6 +1909,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpqvp
-                  res@trXMaxF            = maxiwpqvp 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpqvp
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpqvp
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if 
@@ -1459,6 +1939,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsqvs
-                  res@trXMaxF            = maxiwsqvs 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsqvs
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsqvs
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1473,6 +1969,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwqv
-                  res@trXMaxF            = maxiwqv 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwqv
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwqv
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1488,6 +2000,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpsp
-                  res@trXMaxF            = maxiwpsp 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpsp
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpsp
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if 
@@ -1502,6 +2030,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsss
-                  res@trXMaxF            = maxiwsss 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsss
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsss
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1516,6 +2060,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniws
-                  res@trXMaxF            = maxiws 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniws
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiws
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if 
@@ -1531,6 +2091,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpsap
-                  res@trXMaxF            = maxiwpsap 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpsap
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpsap
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if 
@@ -1545,6 +2121,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwssas
-                  res@trXMaxF            = maxiwssas 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwssas
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwssas
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
                end if
@@ -1559,22 +2151,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsa
-                  res@trXMaxF            = maxiwsa 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "wses") then                
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:))
-                  plot_wses = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min(data(varn,:,:))
-                  res@trXMaxF            = max(data(varn,:,:)) 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsa
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsa
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1590,6 +2182,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minius2
-                  res@trXMaxF            = maxius2 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minius2
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxius2
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if 
@@ -1604,6 +2212,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minivs2
-                  res@trXMaxF            = maxivs2 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = minivs2
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxivs2
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
                end if
@@ -1618,96 +2242,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniws2
-                  res@trXMaxF            = maxiws2 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "pts2") then
-               minipts2=min(data(varn,:,:))
-               maxipts2=max(data(varn,:,:))                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minipts2
-                  res@trXMaxF            = maxipts2
-                  plot_pts2 = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = minipts2
-                  res@trXMaxF            = maxipts2 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "ws3") then
-               miniws3=min(data(varn,:,:))
-               maxiws3=max(data(varn,:,:))                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniws3
-                  res@trXMaxF            = maxiws3
-                  plot_ws3 = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniws3
-                  res@trXMaxF            = maxiws3 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "Sw") then
-               miniSw=min(data(varn,:,:))
-               maxiSw=max(data(varn,:,:))                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniSw
-                  res@trXMaxF            = maxiSw
-                  plot_Sw = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniSw
-                  res@trXMaxF            = maxiSw 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "ws2pts") then
-               miniws2pts=min(data(varn,:,:))
-               maxiws2pts=max(data(varn,:,:))                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniws2pts
-                  res@trXMaxF            = maxiws2pts
-                  plot_ws2pts = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniws2pts
-                  res@trXMaxF            = maxiws2pts 
-                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
-               end if
-            end if
-
-            if (vNam(varn) .EQ. "wspts2") then
-               miniwspts2=min(data(varn,:,:))
-               maxiwspts2=max(data(varn,:,:))                 
-               if (over .EQ. 1) then
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwspts2
-                  res@trXMaxF            = maxiwspts2
-                  plot_wspts2 = gsn_csm_xy(wks,data(varn,:,:),z_w,res)
-               else
-                  res@gsnLeftString      = vNam(varn)
-                  res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwspts2
-                  res@trXMaxF            = maxiwspts2 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniws2
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiws2
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1723,6 +2273,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwsususodz
-                  res@trXMaxF            = maxiwsususodz 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwsususodz
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwsususodz
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
                end if  
@@ -1737,6 +2303,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwspsodz
-                  res@trXMaxF            = maxiwspsodz 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwspsodz
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwspsodz
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_u,res)
                end if 
@@ -1751,6 +2333,22 @@
                   res@gsnLeftString      = vNam(varn)
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = miniwpeodz
-                  res@trXMaxF            = maxiwpeodz 
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF            = miniwpeodz
+                     end if
+                  else 
+                     res@trXMinF            = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF            = maxiwpeodz
+                     end if
+                  else 
+                     res@trXMaxF            = xe  
+                  end if 
                   plot(n) = gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
                end if
@@ -1763,5 +2361,14 @@
       delete(temp) 
    end do
-   
+
+   if (count_var .EQ. 0) then
+      print(" ")
+      print("Please select a variable 'var=' or use the default value")
+      print(" ")
+      print("Your selection '"+var+"' does not exist on the input file")
+      print(" ")
+      exit
+   end if
+
    if (over .EQ. 1 ) then
 
@@ -1836,10 +2443,26 @@
             z = f->$vNam(varn+1)$
            
-            ;res@gsnLeftString      = vNam(varn)
+            res@gsnLeftString      = vNam(varn)
             res@gsnRightString     = unit(varn)
             res@trYMinF            = min_z
             res@trYMaxF            = max_z  
-            res@trXMinF            = min(data(varn,:,:))
-            res@trXMaxF            = max(data(varn,:,:))
+            if (.not. isvar("xs")) then 
+               if (parameter(63) .NE. "x0") then
+                  res@trXMinF = stringtofloat(parameter(63))
+               else
+                  res@trXMinF = min(data(varn,:,:))
+               end if
+            else 
+               res@trXMinF = xs
+            end if
+            if (.not. isvar("xe")) then 
+               if (parameter(65) .NE. "xdim") then
+                  res@trXMaxF = stringtofloat(parameter(65))
+               else
+                  res@trXMaxF = max(data(varn,:,:))
+            end if
+            else 
+               res@trXMaxF = xe  
+            end if 
             plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)  
             
@@ -1848,6 +2471,22 @@
                   res@gsnLeftString      = "u, v and w"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniu,miniv,miniw/))
-                  res@trXMaxF            = max((/maxiu,maxiv,maxiw/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniu,miniv,miniw/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiu,maxiv,maxiw/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if 
                   if (vNam(varn) .EQ. "w") then 
                      plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -1885,6 +2524,22 @@
                   res@gsnLeftString      = "pt, vpt and lpt"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/minipt,minivpt,minilpt/))
-                  res@trXMaxF            = max((/maxipt,maxivpt,maxilpt/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/minipt,minivpt,minilpt/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxipt,maxivpt,maxilpt/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
@@ -1918,6 +2573,22 @@
                   res@gsnLeftString      = "q, qv and ql"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniq,miniqv,miniql/))
-                  res@trXMaxF            = max((/maxiq,maxiqv,maxiql/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniq,miniqv,miniql/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiq,maxiqv,maxiql/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
@@ -1946,20 +2617,28 @@
                   continue   
                end if
-            end if           
-            if (vNam(varn) .EQ. "rho") then
-               plot(n) = plot_rho
-            end if
-            if (vNam(varn) .EQ. "s") then
-               plot(n) = plot_s
-            end if
-            if (vNam(varn) .EQ. "sa") then
-               plot(n) = plot_sa
-            end if
+            end if    
+           
             if (vNam(varn) .EQ. "e" .OR. vNam(varn) .EQ. "es") then
                if (e .EQ. 0) then
                   res@gsnLeftString      = "e and es"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/minie,minies/))
-                  res@trXMaxF            = max((/maxie,maxies/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/minie,minies/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxie,maxies/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
@@ -1993,6 +2672,22 @@
                   res@gsnLeftString      = "km and kh"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/minikm,minikh/))
-                  res@trXMaxF            = max((/maxikm,maxikh/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/minikm,minikh/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxikm,maxikh/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_u,res) 
@@ -2022,13 +2717,27 @@
                end if
             end if           
-            if (vNam(varn) .EQ. "l") then
-               plot(n) = plot_l
-            end if
+           
             if (vNam(varn) .EQ. "wpup" .OR. vNam(varn) .EQ. "wsus" .OR. vNam(varn) .EQ. "wu") then
                if (wpup .EQ. 0) then
                   res@gsnLeftString      = "wpup, wsus and wu"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpup,miniwsus,miniwu/))
-                  res@trXMaxF            = max((/maxiwpup,maxiwsus,maxiwu/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpup,miniwsus,miniwu/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpup,maxiwsus,maxiwu/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2062,6 +2771,22 @@
                   res@gsnLeftString      = "wpvp, wsus and wv"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpvp,miniwsvs,miniwv/))
-                  res@trXMaxF            = max((/maxiwpvp,maxiwsvs,maxiwv/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpvp,miniwsvs,miniwv/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpvp,maxiwsvs,maxiwv/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2095,6 +2820,22 @@
                   res@gsnLeftString      = "wpptp, wspts and wv"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpptp,miniwspts,miniwpt/))
-                  res@trXMaxF            = max((/maxiwpptp,maxiwspts,maxiwpt/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpptp,miniwspts,miniwpt/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpptp,maxiwspts,maxiwpt/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2128,6 +2869,22 @@
                   res@gsnLeftString      = "wsptsBC and wptBC"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwsptsBC,miniwptBC/))
-                  res@trXMaxF            = max((/maxiwsptsBC,maxiwptBC/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwsptsBC,miniwptBC/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwsptsBC,maxiwptBC/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2161,6 +2918,22 @@
                   res@gsnLeftString      = "wpvptp, wsvpts and wv"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpvptp,miniwsvpts,miniwvpt/))
-                  res@trXMaxF            = max((/maxiwpvptp,maxiwsvpts,maxiwvpt/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpvptp,miniwsvpts,miniwvpt/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpvptp,maxiwsvpts,maxiwvpt/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2194,6 +2967,22 @@
                   res@gsnLeftString      = "wpqp, wsqs and wq"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpqp,miniwsqs,miniwq/))
-                  res@trXMaxF            = max((/maxiwpqp,maxiwsqs,maxiwq/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpqp,miniwsqs,miniwq/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpqp,maxiwsqs,maxiwq/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2227,6 +3016,22 @@
                   res@gsnLeftString      = "wpqvp, wsqvs and wqv"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpqp,miniwsqvs,miniwqv/))
-                  res@trXMaxF            = max((/maxiwpqp,maxiwsqvs,maxiwqv/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpqp,miniwsqvs,miniwqv/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpqp,maxiwsqvs,maxiwqv/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2260,6 +3065,22 @@
                   res@gsnLeftString      = "wpsp, wsss and ws"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpsp,miniwsss,miniws/))
-                  res@trXMaxF            = max((/maxiwpsp,maxiwsss,maxiws/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpsp,miniwsss,miniws/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpsp,maxiwsss,maxiws/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2293,6 +3114,22 @@
                   res@gsnLeftString      = "wpsap, wssas and wsa"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwpsap,miniwssas,miniwsa/))
-                  res@trXMaxF            = max((/maxiwpsap,maxiwssas,maxiwsa/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwpsap,miniwssas,miniwsa/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwpsap,maxiwssas,maxiwsa/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2322,13 +3159,27 @@
                end if
             end if
-            if (vNam(varn) .EQ. "wses") then
-               plot(n) = plot_wses
-            end if
+          
             if (vNam(varn) .EQ. "us2" .OR. vNam(varn) .EQ. "vs2" .OR. vNam(varn) .EQ. "ws2") then
                if (us2 .EQ. 0) then
                   res@gsnLeftString      = "us2, vs2 and ws2"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/minius2,minivs2,miniws2/))
-                  res@trXMaxF            = max((/maxius2,maxivs2,maxiws2/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/minius2,minivs2,miniws2/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxius2,maxivs2,maxiws2/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2358,25 +3209,27 @@
                end if
             end if
-            if (vNam(varn) .EQ. "pts2") then
-               plot(n) = plot_pts2 
-            end if
-            if (vNam(varn) .EQ. "ws3") then
-               plot(n) = plot_ws3
-            end if
-            if (vNam(varn) .EQ. "Sw") then
-               plot(n) = plot_Sw
-            end if
-            if (vNam(varn) .EQ. "ws2pts") then
-               plot(n) = plot_ws2pts
-            end if
-            if (vNam(varn) .EQ. "wspts2") then
-               plot(n) = plot_wspts2 
-            end if
+           
             if (vNam(varn) .EQ. "wsususodz" .OR. vNam(varn) .EQ. "wspsodz" .OR. vNam(varn) .EQ. "wpeodz" ) then
                if (wsususodz .EQ. 0) then 
                   res@gsnLeftString      = "wsususodz, wspsodz and ws2"
                   res@gsnRightString     = unit(varn)
-                  res@trXMinF            = min((/miniwsususodz,miniwspsodz,miniwpeodz/))
-                  res@trXMaxF            = max((/maxiwsususodz,maxiwspsodz,maxiwpeodz/))
+                  if (.not. isvar("xs")) then 
+                     if (parameter(63) .NE. "x0") then
+                        res@trXMinF = stringtofloat(parameter(63))
+                     else
+                        res@trXMinF = min((/miniwsususodz,miniwspsodz,miniwpeodz/))
+                     end if
+                  else 
+                     res@trXMinF = xs
+                  end if
+                  if (.not. isvar("xe")) then 
+                     if (parameter(65) .NE. "xdim") then
+                        res@trXMaxF = stringtofloat(parameter(65))
+                     else
+                        res@trXMaxF = max((/maxiwsususodz,maxiwspsodz,maxiwpeodz/))
+                     end if
+                  else 
+                     res@trXMaxF = xe  
+                  end if
 
                   plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z_w,res) 
@@ -2449,6 +3302,22 @@
                      res@gsnLeftString  = c_var
                      res@gsnRightString = unit(varn)
-                     res@trXMinF        = min(mini)
-                     res@trXMaxF        = max(maxi)
+                     if (.not. isvar("xs")) then 
+                        if (parameter(63) .NE. "x0") then
+                           res@trXMinF = stringtofloat(parameter(63))
+                        else
+                           res@trXMinF = min(mini)
+                        end if
+                     else 
+                        res@trXMinF = xs
+                     end if
+                     if (.not. isvar("xe")) then 
+                        if (parameter(65) .NE. "xdim") then
+                           res@trXMaxF = stringtofloat(parameter(65))
+                        else
+                           res@trXMaxF = max(maxi)
+                        end if
+                     else 
+                        res@trXMaxF = xe  
+                     end if 
                   end if
                end if
@@ -2496,5 +3365,5 @@
    ; merge plots onto one page 
    ; ***************************************************
- print(n)
+
    do m=0,n-1
       plot_(m)=plot(n-1-m)
