Ignore:
Timestamp:
Aug 16, 2008 12:18:08 PM (16 years ago)
Author:
letzel
Message:
  • NCL scripts in trunk/SCRIPTS/NCL updated to version 2.0 (.ncl_preferences replaced by ncl_preferences.ncl)
File:
1 edited

Legend:

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

    r175 r190  
    55load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
    66
     7;***************************************************
     8; load ncl_preferences.ncl
     9;***************************************************
     10   
     11if (isfilepresent("~/ncl_preferences.ncl")) then
     12   loadscript("~/ncl_preferences.ncl")
     13else
     14  if (isfilepresent("~/palm/current_version/trunk/SCRIPTS/NCL/ncl_preferences.ncl")) then
     15     loadscript( "~/palm/current_version/trunk/SCRIPTS/NCL/ncl_preferences.ncl")
     16  else
     17      print(" ")
     18      print("'ncl_preferences.ncl' does not exist in $home or $home/palm/current_version/trunk/SCRIPTS/NCL/")
     19      print(" ")
     20      exit
     21   end if
     22end if
     23   
    724begin
    825
    9    ; ***************************************************
    10    ; read parameter_list
    11    ; ***************************************************
    12 
    13    if (isfilepresent("~/.ncl_preferences")) then
    14       parameter = asciiread("~/.ncl_preferences",129,"string")
    15       delete(parameter@_FillValue)
    16    else
    17       if (isfilepresent("~/palm/current_version/trunk/SRIPTS/NCL/.ncl_preferences")) then
    18          parameter = asciiread("~/palm/current_version/trunk/SRIPTS/NCL/.ncl_preferences",129,"string")
    19          delete(parameter@_FillValue)
    20       else
    21          print(" ")
    22          print("'.ncl_preferences' is not present in '~/palm/current_version/trunk/SRIPTS/NCL/'")
    23          print(" ")
    24          exit
    25       end if
     26   if (cross_sections .NE. 1 .OR. profiles .NE. 0 .OR. timeseries .NE. 0 .OR. spectra .NE. 0)then
     27      print(" ")
     28      print("Please specify the used script in 'ncl_preferences.ncl' (Line 7-10)")
     29      print(" ")
     30      print("Set 'cross_sections' equal 1 and the other variables equal 0")
     31      print(" ")
     32      exit
    2633   end if
    2734
     
    3037   ; ***************************************************
    3138   
    32    if ( .not. isvar("file_1") ) then                     
    33       if (parameter(7) .EQ. "File in") then
    34          print(" ")
    35          print("Please provide 1st input file 'file_1=' either in prompt or parameter_list")
    36          print(" ")
    37          exit
    38       else
    39          file_in = parameter(7)
    40       end if   
     39   if (file_1 .EQ. "File in") then
     40      print(" ")
     41      print("Please provide 1st input file 'file_1=' in 'ncl_preferences.ncl'")
     42      print(" ")
     43      exit
    4144   else
    4245      file_in = file_1   
     
    4447   if (.not. isfilepresent(file_in)) then
    4548      print(" ")
    46       print("Your 1st input file: '"+file_in+"' does not exist")
     49      print("1st input file: '"+file_in+"' does not exist")
    4750      print(" ")
    4851      exit
    4952   end if
    5053
    51    if ( .not. isvar("format_out") ) then               
    52       format_out = "x11"
    53       if (parameter(9) .NE. "x11") then
    54          format_out = parameter(9) 
    55          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
    56             print(" ")
    57             print("Your 'format_out = "+format_out+"' is invalid and set to'x11'")
    58             print(" ")
    59          end if 
    60       end if
    61    else
    62       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
    63          print(" ")
    64          print("Your 'format_out = "+format_out+"' is invalid and set to'x11'")
    65          print(" ")
    66       end if   
    67    end if
    68 
    69    if ( .not. isvar("file_out") ) then                 
    70       file_out = "test"
    71       if (parameter(11) .NE. "test") then
    72          file_out = parameter(11) 
    73      end if     
    74    end if
    75    if ( .not. isvar("no_columns") ) then               
    76       no_columns = 1
    77       if (parameter(17) .NE. "1") then
    78          no_columns = stringtointeger(parameter(17)) 
    79       end if
    80    end if
    81    if ( .not. isvar("no_lines") ) then                 
    82       no_lines = 2
    83       if (parameter(19) .NE. "2") then
    84          no_lines = stringtointeger(parameter(19)) 
    85       end if
     54   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
     55      print(" ")
     56      print("'format_out = "+format_out+"' is invalid and set to'x11'")
     57      print(" ")
     58      format_out="x11"
     59   end if
     60
     61   if (sort .NE. "layer" .AND. sort .NE. "time") then 
     62      print(" ")
     63      print("'sort'= "+sort+" is invalid and set to 'layer'")
     64      print(" ")
     65      sort = "layer" 
     66   end if
     67   
     68   if (mode .NE. "Fill" .AND. mode .NE. "Line" .AND. mode .NE. "Both") then
     69      print(" ")
     70      print("'mode'= "+mode+" is invalid and set to 'Fill'")
     71      print(" ")
     72      mode = "Fill"
     73   end if
     74
     75   if (fill_mode .NE. "AreaFill" .AND. fill_mode .NE. "RasterFill" .AND. fill_mode .NE. "CellFill") then
     76      print(" ")
     77      print("Your 'fill_mode'= "+fill_mode+" is invalid and set to 'AreaFill'")
     78      print(" ")
     79      fill_mode = "AreaFill"
     80   end if
     81   
     82   if (shape .NE. 0 .AND. shape .NE. 1) then
     83      print(" ")
     84      print("'shape'= "+shape+" is invalid and set to 1")
     85      print(" ")
     86      shape = 1
    8687   end if
    87 
    88    if ( .not. isvar("sort") ) then                     
    89       sort = "layer"
    90       if (parameter(51) .NE. "layer") then
    91          sort = parameter(51) 
    92          if (sort .NE. "time") then
    93             print(" ")
    94             print("Your 'sort'= "+sort+" is invalid and set to 'layer'")
    95             print(" ")
    96             sort = "layer" 
    97          end if
    98       end if
    99    else
    100       if (sort .NE. "time" .OR. sort .NE. "layer")then
    101          print(" ")
    102          print("Your 'sort'= "+sort+" is invalid and set to 'layer'")
    103          print(" ")
    104          sort = "layer"   
    105       end if
    106    end if
    107 
    108    if ( .not. isvar("mode") ) then                     
    109       mode = "Fill"
    110       if (parameter(49) .NE. "Fill") then
    111          mode = parameter(49) 
    112          if (mode .NE. "Line" .AND. mode .NE. "Both")then
    113             print(" ")
    114             print("Your 'mode'= "+mode+" is invalid and set to 'Fill'")
    115             print(" ")
    116             mode = "Fill"
    117          end if
    118       end if
    119    else
    120       if (mode .NE. "Line" .AND. mode .NE. "Both")then
    121          print(" ")
    122          print("Your 'mode'= "+mode+" is invalid and set to 'Fill'")
    123          print(" ")
    124          mode = "Fill"
    125       end if   
    126    end if
    127 
    128    if ( .not. isvar("fill_mode") ) then                 
    129       fill_mode = "AreaFill"
    130       if (parameter(53) .NE. "AreaFill") then
    131          fill_mode = parameter(53) 
    132          if (fill_mode .NE. "RasterFill" .AND. fill_mode .NE. "CellFill")then
    133             print(" ")
    134             print("Your 'fill_mode'= "+fill_mode+" is invalid and set to 'AreaFill'")
    135             print(" ")
    136             fill_mode = "AreaFill"
    137          end if
    138       end if
    139    else
    140       if (fill_mode .NE. "RasterFill" .AND. fill_mode .NE. "CellFill")then
    141          print(" ")
    142          print("Your 'fill_mode'= "+fill_mode+" is invalid and set to 'AreaFill'")
    143          print(" ")
    144          fill_mode = "AreaFill"
    145       end if
    146    end if
    147 
    148    if ( .not. isvar("shape") ) then                     
    149       shape = 1
    150       if (parameter(55) .NE. "1") then
    151          shape = stringtointeger(parameter(55))
    152          if (shape .NE. 0) then
    153             print(" ")
    154             print("Your 'shape'= "+shape+" is invalid and set to 1")
    155             print(" ")
    156             shape = 1
    157          end if
    158       end if
    159    else
    160       if (shape .NE. 0) then
    161          print(" ")
    162          print("Your 'shape'= "+shape+" is invalid and set to 1")
    163          print(" ")
    164          shape = 1
    165       end if     
    166    end if
    167  
    168    if ( .not. isvar("var") ) then                       
    169       check = True
    170    end if
    171 
    172    if ( .not. isvar("xyc") ) then                       
    173       xyc = 0
    174       if (parameter(57) .NE. "0") then
    175          xyc = stringtointeger(parameter(57))
    176          if (xyc .NE. 1) then
    177             print(" ")
    178             print("Your 'xyc'= "+xyc+" is invalid and set to 0")
    179             print(" ")
    180             xyc = 0
    181          end if
    182       end if
    183    else
    184       if (xyc .NE. 1) then
    185          print(" ")
    186          print("Your 'xyc'= "+xyc+" is invalid and set to 0")
    187          print(" ")
    188          xyc = 0
    189       end if
    190    end if
    191    if ( .not. isvar("xzc") ) then                       
    192       xzc = 0
    193       if (parameter(59) .NE. "0") then
    194          xzc = stringtointeger(parameter(59))
    195          if (xzc .NE. 1) then
    196             print(" ")
    197             print("Your 'xzc'= "+xzc+" is invalid and set to 0")
    198             print(" ")
    199             xzc = 0
    200          end if
    201       end if
    202    else
    203       if (xzc .NE. 1) then
    204          print(" ")
    205          print("Your 'xzc'= "+xzc+" is invalid and set to 0")
    206          print(" ")
    207          xzc = 0
    208       end if
    209    end if
    210    if ( .not. isvar("yzc") ) then                       
    211       yzc = 0
    212       if (parameter(61) .NE. "0") then
    213          yzc = stringtointeger(parameter(61))
    214          if (yzc .NE. 1) then
    215             print(" ")
    216             print("Your 'yzc'= "+yzc+" is invalid and set to 0")
    217             print(" ")
    218             yzc = 0
    219          end if
    220       end if
    221    else
    222       if (yzc .NE. 1) then
    223          print(" ")
    224          print("Your 'yzc'= "+yzc+" is invalid and set to 0")
    225          print(" ")
    226          yzc = 0
    227       end if
    228    end if
    229 
     88   
     89   if (xyc .NE. 0 .AND. xyc .NE. 1)then
     90      print(" ")
     91      print("'xyc'= "+xyc+" is invalid and set to 0")
     92      print(" ")
     93      xyc = 0 
     94   end if
     95   
     96   if (xzc .NE. 0 .AND. xzc .NE. 1)then
     97      print(" ")
     98      print("'xzc'= "+xzc+" is invalid and set to 0")
     99      print(" ")
     100      xyc = 0 
     101   end if
     102   
     103   if (yzc .NE. 0 .AND. yzc .NE. 1)then
     104      print(" ")
     105      print("'yzc'= "+yzc+" is invalid and set to 0")
     106      print(" ")
     107      xyc = 0 
     108   end if
     109   
    230110   if (xyc .EQ. 0 .AND. xzc .EQ. 0 .AND. yzc .EQ. 0) then
    231111      print(" ")
     
    258138      end if
    259139   end if
    260    if ( .not. isvar("vector") ) then           
    261       vector = 0
    262       if (parameter(39) .NE. "0") then
    263          vector = stringtointeger(parameter(39))
    264          if (stringtointeger(parameter(39)) .NE. 1) then
    265             print(" ")
    266             print("Please set 'vector' to 0 or 1")
    267             print(" ")
    268             exit
    269          end if   
    270       end if
    271    end if
    272    if ( .not. isvar("ref_mag") ) then                           
    273       ref_mag = 0.05
    274       if (parameter(47) .NE. "0.05") then
    275          ref_mag = stringtofloat(parameter(47))   
    276       end if
    277    end if
    278 
     140
     141   if (vector .NE. 0 .AND. vector .NE. 1) then
     142      print(" ")
     143      print("Please set 'vector' to 0 or 1")
     144      print(" ")
     145      exit
     146   end if   
     147 
    279148   ; ***************************************************
    280149   ; open input file
     
    285154   vNam  = getfilevarnames(f)
    286155   print(" ")
    287    print("Variable on netCDF file: " + vNam)
     156   print("Variables in input file:")
     157   print("- "+ vNam)
    288158   print(" ")
    289159   dim   = dimsizes(vNam)
     
    369239   cs_res                          = True
    370240   cs_res@gsnYAxisIrregular2Linear = True 
    371 
    372    if( shape .eq. 1 ) then                             
    373       cs_res@gsnShape = True
    374    end if
    375241 
    376242   cs_res@gsnDraw                 = False
     
    381247   cs_res@gsnPaperHeight          = 11.69
    382248   cs_res@gsnPaperMargin          = 0.79
    383    cs_res@tmXBLabelFontHeightF   = .02
    384    cs_res@tmYLLabelFontHeightF   = .02
    385    cs_res@tiXAxisFontHeightF     = .02
    386    cs_res@tiYAxisFontHeightF     = .02
     249   cs_res@tmXBLabelFontHeightF   = .03
     250   cs_res@tmYLLabelFontHeightF   = .03
     251   cs_res@tiXAxisFontHeightF     = .03
     252   cs_res@tiYAxisFontHeightF     = .03
    387253   cs_res@tmXBMode                ="Automatic"
    388254   cs_res@tmYLMode                ="Automatic"
    389    cs_res@lgTitleFontHeightF     = .02
    390    cs_res@lgLabelFontHeightF     = .02
    391    cs_res@txFontHeightF          = .02
     255   cs_res@lgTitleFontHeightF     = .03
     256   cs_res@lgLabelFontHeightF     = .03
     257   cs_res@txFontHeightF          = .03
    392258   cs_res@cnLevelSelectionMode    = "ManualLevels"
    393259
     
    428294   ; ****************************************************
    429295
    430    if ( .not. isvar("start_time_step") ) then           
    431       start_time_step=t_all(0)/3600
    432       if (parameter(13) .NE. "t(0)") then
    433          if (stringtodouble(parameter(13)) .GT. t_all(nt-1)/3600)
    434             print(" ")
    435             print("'start_time_step' = "+ parameter(13) +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
    436             print(" ")
    437             print("Please select another 'start_time_step'")
    438             print(" ")
    439             exit
    440          end if
    441          if (stringtofloat(parameter(13)) .LT. t_all(0)/3600)
    442             print(" ")
    443             print("'start_time_step' = "+ parameter(13) +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
    444             print(" ")
    445             print("Please select another 'start_time_step'")
    446             print(" ")
    447             exit
    448          end if
    449          start_time_step=stringtodouble(parameter(13))
    450       end if
     296   if (start_time_step .EQ. -1.) then           
     297      start_time_step=t_all(0)/3600     
    451298   else
    452299      if (start_time_step .GT. t_all(nt-1)/3600)
     
    467314      end if
    468315   end if
    469    start_time_step = start_time_step*3600
    470316   do i=0,nt-1     
    471       if (start_time_step .GE. t_all(i)-delta_t/2 .AND. start_time_step .LT. t_all(i)+delta_t/2)then
     317      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
    472318         st=i
    473319         break
    474320      end if
    475321   end do
     322   
     323   if (.not. isvar("st"))then
     324      print(" ")
     325      print("'start_time_step' = "+ start_time_step +"h is invalid")
     326      print(" ")
     327      print("Please select another 'start_time_step'")
     328      print(" ")
     329      exit
     330   end if
    476331       
    477332   ; ****************************************************
     
    479334   ; ****************************************************
    480335
    481    if ( .not. isvar("end_time_step") ) then             
    482       end_time_step = t_all(nt-1)/3600
    483       if (parameter(15) .NE. "t(end)") then
    484          if (stringtodouble(parameter(15)) .LT. t_all(0)/3600)
    485             print(" ")
    486             print("'end_time_step' = "+parameter(15)+ "h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
    487             print(" ")
    488             print("Please select another 'end_time_step'")
    489             print(" ")
    490             exit
    491          end if
    492          if (stringtodouble(parameter(15)) .GT. t_all(nt-1)/3600)
    493             print(" ")
    494             print("'end_time_step' = "+ parameter(15) +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
    495             print(" ")
    496             print("Please select another 'end_time_step'") 
    497             print(" ")
    498             exit
    499          end if
    500          if (stringtodouble(parameter(15)) .LT. start_time_step/3600)
    501             print(" ")
    502             print("'end_time_step' = "+ parameter(15) +"h is lower than 'start_time_step' = "+parameter(13)+"h")
    503             print(" ")
    504             print("Please select another 'start_time_step' or 'end_time_step'")
    505             print(" ")
    506             exit
    507          end if
    508          end_time_step = stringtodouble(parameter(15))
    509       end if   
    510    else
     336   if (end_time_step .EQ. -1.) then             
     337      end_time_step = t_all(nt-1)/3600 
     338   else 
    511339      if (end_time_step .LT. t_all(0)/3600)
    512340         print(" ")
     
    534362      end if
    535363   end if
    536    end_time_step = end_time_step*3600
    537364   do i=0,nt-1     
    538       if (end_time_step .GE. t_all(i)-delta_t/2 .AND. end_time_step .LT. t_all(i)+delta_t/2)then
     365      if (end_time_step .GE. (t_all(i)-delta_t/2)/3600 .AND. end_time_step .LT. (t_all(i)+delta_t/2)/3600)then
    539366         et=i
    540367         break
    541368      end if
    542369   end do
     370   
     371   if (.not. isvar("et"))then
     372      print(" ")
     373      print("'end_time_step' = "+ end_time_step +"h is invalid")
     374      print(" ")
     375      print("Please select another 'end_time_step'")
     376      print(" ")
     377      exit
     378   end if
    543379 
    544380   delete(start_time_step)
     
    559395
    560396   if (vector .EQ. 1) then
    561       if ( .not. isvar("plotvec") ) then
    562          plotvec = parameter(45)
    563       end if
    564       if ( .not. isvar("vec1") ) then
    565          vec1 = parameter(41)
    566          if (parameter(41) .EQ. "vec1") then
    567             print(" ")
    568             print("Please indicate Vector 1 ('vec1') for Vector-Plot")
    569             print(" ")
    570             exit
    571          end if
    572       end if
    573       if ( .not. isvar("vec2") ) then
    574          vec2 = parameter(43)
    575          if (parameter(43) .EQ. "vec2") then
    576             print(" ")
    577             print("Please indicate Vector 2 ('vec2') for Vector-Plot")
    578             print(" ")
    579             exit
    580          end if
    581       end if             
     397      if (vec1 .EQ. "component1") then
     398         print(" ")
     399         print("Please indicate Vector 1 ('vec1') for Vector-Plot or set 'vector' to 0")
     400         print(" ")
     401         exit
     402      end if
     403      if (vec2 .EQ. "component2") then
     404         print(" ")
     405         print("Please indicate Vector 2 ('vec2') for Vector-Plot or set 'vector' to 0")
     406         print(" ")
     407         exit
     408      end if           
    582409   end if
    583410
     
    592419   if (xyc .EQ. 1) then
    593420      do varn=0,dim-1
    594          if (vNam(varn) .eq. "xu"  .OR. vNam(varn) .eq. "x")then   
     421         if (vNam(varn) .eq. "xu" .OR. vNam(varn) .eq. "x")then   
    595422            x_d     = f->$vNam(varn)$
    596423            xdim    = dimsizes(x_d)-1
     
    703530   ; ****************************************************         
    704531                   
    705    if ( .not. isvar("xs") ) then               
    706       xs     = 0.0d
    707       xstart = 0
    708       if (parameter(63) .NE. "x0") then
    709          if (delta_x .EQ. -1) then
    710             print(" ")
    711             print("You cannot choose a start value for x, there are preseted layers for x")
    712             print(" ")
    713             xstart=0
    714          else
    715             if (stringtodouble(parameter(63)) .LT. 0-delta_x/2) then
    716                print(" ")
    717                print("range start for x-coordinate = "+parameter(63)+"m is lower than first value x = "+0+"m or xu = "+(0-delta_x/2)+"m")
    718                print(" ")
    719                exit
    720             end if
    721             if (xyc .EQ. 1 .OR. xzc .EQ. 1) then
    722                if (stringtodouble(parameter(63)) .GE. xdim*delta_x) then
    723                   print(" ")
    724                   print("range start for x-coordinate = "+parameter(63)+"m is equal or greater than last value = "+xdim*delta_x+"m")
    725                   print(" ")
    726                   exit
    727                end if
    728             else
    729                if (stringtodouble(parameter(63)) .GT. xdim*delta_x) then
    730                   print(" ")
    731                   print("range start for x-coordinate = "+parameter(63)+"m is greater than last value = "+xdim*delta_x+"m")
    732                   print(" ")
    733                   exit
    734                end if
    735             end if
    736             xs = stringtodouble(parameter(63))
    737          end if
    738       end if
    739    else
     532   if (xs .EQ. -1.d) then               
     533      xs = x_d(0)
     534   else
    740535      if (delta_x .EQ. -1) then
    741536         print(" ")
     
    768563   end if
    769564
    770    if ( .not. isvar("ys") ) then   
    771       ys = 0.0d
    772       ystart = 0
    773       if (parameter(67) .NE. "y0") then
    774          if (delta_y .EQ. -1) then
    775             print(" ")
    776             print("You cannot choose a start value for y, there are preseted layers for y")
    777             print(" ")
    778             ystart=0
    779          else
    780             if (stringtodouble(parameter(67)) .LT. 0-delta_y/2) then
    781                print(" ")
    782                print("range start for y-coordinate = "+parameter(67)+"m is lower than first value = "+0-delta_y/2+"m")
    783                print(" ")
    784                exit
    785             end if
    786             if (xyc .EQ. 1 .OR. yzc .EQ. 1) then
    787                if (stringtodouble(parameter(67)) .GE. ydim*delta_y) then
    788                   print(" ")
    789                   print("range start for y-coordinate = "+parameter(67)+"m is equal or greater than last value = "+ydim*delta_y+"m")
    790                   print(" ")
    791                   exit
    792                end if
    793             else
    794                if (stringtodouble(parameter(67)) .GT. ydim*delta_y) then
    795                   print(" ")
    796                   print("range start for y-coordinate = "+parameter(67)+"m is greater than last value = "+ydim*delta_y+"m")
    797                   print(" ")
    798                   exit
    799                end if
    800             end if
    801             ys = stringtodouble(parameter(67))
    802          end if
    803       end if
     565   if (ys .EQ. -1.d) then   
     566      ys = y_d(0)
    804567   else
    805568      if (delta_y .EQ. -1) then
     
    833596   end if
    834597 
    835    if ( .not. isvar("zs") ) then                       
     598   if (zs .EQ. -1) then                         
    836599      zs = 0
    837       if (parameter(71) .NE. "z0") then
    838          if (delta_z .EQ. -1) then
    839             print(" ")
    840             print("You cannot choose a start value for z, there are preseted layers for z")
    841             print(" ")
    842          else
    843             print(" ")
    844             print("Please mind to indicate start and end ranges for the z-coordinate in")
    845             print("indices not in 'meters'. Corresponding index and meter:")
    846             print(" ")
    847             print(" = "+z_d+" m")
    848             print(" ")
    849             if (stringtointeger(parameter(71)) .LT. 0) then
    850                print(" ")
    851                print("range start for z-coordinate = "+parameter(71)+" is lower than first gridpoint = 0")
    852                print(" ")
    853                exit
    854             end if
    855             if (xzc .EQ. 1 .OR. yzc .EQ. 1) then
    856                if (stringtointeger(parameter(71)) .GE. zdim) then
    857                   print(" ")
    858                   print("range start for z-coordinate = "+parameter(71)+" is equal or greater than last gridpoint = "+zdim)
    859                   print(" ")
    860                   exit
    861                end if
    862             else
    863                if (stringtodouble(parameter(71)) .GT. zdim) then
    864                   print(" ")
    865                   print("range start for z-coordinate = "+parameter(71)+" is greater than last gridpoint = "+zdim)
    866                   print(" ")
    867                   exit
    868                end if
    869             end if
    870             zs = stringtointeger(parameter(71))
    871          end if
    872       end if
    873600   else
    874601      if (delta_z .EQ. -1) then
     
    901628   end if 
    902629
    903    if ( .not. isvar("xe")) then   
    904       xe   = xdim*delta_x
    905       xend = xdim
    906       if (parameter(65) .NE. "xdim") then
    907          if (delta_x .EQ. -1) then
    908             print(" ")
    909             print("You cannot choose an end value for x, there are preseted layers for x")
    910             print(" ")
    911             xend=xdim           
    912          else
    913             if (stringtodouble(parameter(65)) .GT. xdim*delta_x) then
    914                print(" ")
    915                print("range end for x-coordinate = "+parameter(65)+"m is greater than last value = "+xdim*delta_x+"m")
    916                print(" ")
    917                exit
    918             end if
    919             if (xyc .EQ. 1 .OR. xzc .EQ. 1) then
    920                if (stringtodouble(parameter(65)) .LE. 0-delta_x/2)
    921                   print(" ")
    922                   print("range end for x-coordinate = "+parameter(65)+"m is equal or lower than first value = "+(0-delta_x/2)+"m")
    923                   print(" ")
    924                   exit
    925                end if
    926                if (stringtodouble(parameter(65)) .LE. xs) then
    927                   print(" ")
    928                   print("range end for x-coordinate = "+parameter(65)+"m is equal or lower than start range = "+xs+"m")
    929                   print(" ")
    930                   exit
    931                end if
    932             else
    933                if (stringtodouble(parameter(65)) .LT. 0-delta_x/2)
    934                   print(" ")
    935                   print("range end for x-coordinate = "+parameter(65)+"m is lower than first value = "+(0-delta_x/2)+"m")
    936                   print(" ")
    937                   exit
    938                end if
    939                if (stringtodouble(parameter(65)) .LT. xs) then
    940                   print(" ")
    941                   print("range end for x-coordinate = "+parameter(65)+"m is lower than start range = "+xs+"m")
    942                   print(" ")
    943                   exit
    944                end if
    945             end if         
    946             xe = stringtodouble(parameter(65))
    947          end if
    948       end if
     630   if (xe .EQ. -1) then   
     631      xe = x_d(xdim)
    949632   else
    950633      if (delta_x .EQ. -1) then
     
    973656               exit
    974657            end if
    975             if (stringtodouble(xe .EQ. xs+1)) then
     658            if (xe .EQ. xs+1) then
    976659               print(" ")
    977660               print("range end for x-coordinate = "+xe+"m must be at least two more gridpoints greater than start range = "+xs+"m")
     
    995678      end if               
    996679   end if
    997 
    998    if ( .not. isvar("ye")) then 
    999       ye   = ydim*delta_y
    1000       yend = ydim
    1001       if (parameter(69) .NE. "ydim") then
    1002          if (delta_y .EQ. -1) then
    1003             print(" ")
    1004             print("You cannot choose an end value for y, there are preseted layers for y")
    1005             print(" ")
    1006             yend=ydim
    1007          else
    1008             if (stringtodouble(parameter(69)) .GT. ydim*delta_y) then
    1009                print(" ")
    1010                print("range end for y-coordinate = "+parameter(69)+"m is greater than last value = "+ydim*delta_y+"m")
    1011                print(" ")
    1012                exit
    1013             end if
    1014             if (xyc .EQ. 1 .OR. yzc .EQ. 1) then
    1015                if (stringtodouble(parameter(69)) .LE. 0-delta_y/2)
    1016                   print(" ")
    1017                   print("range end for y-coordinate = "+parameter(69)+"m is equal or lower than first value = "+(0-delta_y/2)+"m")
    1018                   print(" ")
    1019                   exit
    1020                end if
    1021                if (stringtodouble(parameter(69)) .LE. ys) then
    1022                   print(" ")
    1023                   print("range end for y-coordinate = "+parameter(69)+"m is equal or lower than start range = "+ys+"m")
    1024                   print(" ")
    1025                   exit
    1026                end if
    1027                if (stringtodouble(parameter(69)) .EQ. ys+1) then
    1028                   print(" ")
    1029                   print("range end for y-coordinate = "+parameter(69)+"m must be at least two more gridpoints greater than start range = "+ys+"m")
    1030                   print(" ")
    1031                   exit
    1032                end if
    1033             else
    1034                if (stringtodouble(parameter(69)) .LT. 0-delta_y/2)
    1035                   print(" ")
    1036                   print("range end for y-coordinate = "+parameter(69)+"m is lower than first value = "+(0-delta_y/2)+"m")
    1037                   print(" ")
    1038                   exit
    1039                end if
    1040                if (stringtodouble(parameter(69)) .LT. ys) then
    1041                   print(" ")
    1042                   print("range end for y-coordinate = "+parameter(69)+"m is lower than start range = "+ys+"m")
    1043                   print(" ")
    1044                   exit
    1045                end if
    1046             end if         
    1047             ye = stringtodouble(parameter(69))
    1048          end if
    1049       end if
     680   
     681   if (ye .EQ. -1) then 
     682      ye = y_d(ydim)
    1050683   else
    1051684      if (delta_y .EQ. -1) then
     
    1097730   end if
    1098731 
    1099    if ( .not. isvar("ze")) then 
     732   if (ze .EQ. -1) then 
    1100733      ze = zdim
    1101       if (parameter(73) .NE. "zdim") then
    1102          if (delta_z .EQ. -1) then
    1103             print(" ")
    1104             print("You cannot choose an end value for z, there are preseted layers for z")
    1105             print(" ")           
    1106          else
    1107             if (stringtointeger(parameter(73)) .GT. zdim) then
    1108                print(" ")
    1109                print("range end for z-coordinate = "+parameter(73)+" is greater than last gridpoint = "+zdim)
    1110                print(" ")
    1111                exit
    1112             end if
    1113          if (xzc .EQ. 1 .OR. yzc .EQ. 1) then
    1114             if (stringtointeger(parameter(73)) .LE. 0)
    1115                print(" ")
    1116                print("range end for z-coordinate = "+parameter(73)+" is equal or lower than first gridpoint = 0")
    1117                print(" ")
    1118                exit
    1119             end if
    1120             if (stringtointeger(parameter(73)) .LE. zs) then
    1121                print(" ")
    1122                print("range end for z-coordinate = "+parameter(73)+" is equal or lower than start range = "+zs)
    1123                print(" ")
    1124                exit
    1125             end if
    1126             if (stringtodouble(parameter(73)) .EQ. zs+1) then
    1127                print(" ")
    1128                print("range end for z-coordinate = "+parameter(73)+" must be at least two more gridpoints greater than start range = "+zs)
    1129                print(" ")
    1130                exit
    1131             end if
    1132          else
    1133             if (stringtointeger(parameter(73)) .LT. 0)
    1134                print(" ")
    1135                print("range end for z-coordinate = "+parameter(73)+" is lower than first gridpoint = 0")
    1136                print(" ")
    1137                exit
    1138             end if
    1139             if (stringtointeger(parameter(73)) .LT. zs) then
    1140                print(" ")
    1141                print("range end for z-coordinate = "+parameter(73)+" is lower than start range = "+zs)
    1142                print(" ")
    1143                exit
    1144             end if
    1145          end if         
    1146          ze = stringtointeger(parameter(73))
    1147       end if
    1148       end if
    1149734   else
    1150735      if (delta_z .EQ. -1) then
     
    1211796   end if
    1212797   if (delta_y .NE. -1) then
    1213       do i=0,xdim   
     798      do i=0,ydim   
    1214799         if (ys .GT. y_d(i)-delta_y/2 .AND. ys .LE. y_d(i)+delta_y/2)then
    1215800            ystart=i
     
    1217802         end if
    1218803      end do
    1219       do i=0,xdim   
     804      do i=0,ydim   
    1220805         if (ye .GT. y_d(i)-delta_y/2 .AND. ye .LE. y_d(i)+delta_y/2)then
    1221806            yend=i
     
    1223808         end if
    1224809      end do
     810   end if
     811   
     812   if( shape .eq. 1 ) then
     813      cs_res@vpWidthF    = (xe-xs)/(ye-ys)       
     814      cs_res@vpHeightF   = 1
    1225815   end if
    1226816   
     
    1238828      if (xe .EQ. xs+1) then
    1239829         print(" ")
    1240          print("range end for x-coordinate="+parameter(65)+"m(=>value on file="+xe*delta_x+"m) must be at least two")
    1241          print("more gridpoints(="+2*delta_x+"m) greater than start range="+parameter(63)+"m(=>value on file="+xs*delta_x+"m)")
     830         print("range end for x-coordinate="+xe*delta_x+"m) must be at least two")
     831         print("more gridpoints(="+2*delta_x+"m) greater than start range="+xs*delta_x+"m)")
    1242832         print(" ")
    1243833         exit
     
    1247837      if (ye .EQ. ys+1) then
    1248838         print(" ")
    1249          print("range end for y-coordinate="+parameter(69)+"m(=>value on file="+ye*delta_y+"m) must be at least two")
    1250          print("more gridpoints(="+2*delta_y+"m) greater than start range="+parameter(67)+"m(=>value on file="+ys*delta_y+"m)")
     839         print("range end for y-coordinate="+ye*delta_y+"m) must be at least two")
     840         print("more gridpoints(="+2*delta_y+"m) greater than start range="+ys*delta_y+"m)")
    1251841         print(" ")
    1252842         exit
     
    1256846      if (ze .EQ. zs+1) then
    1257847         print(" ")
    1258          print("range end for x-coordinate="+parameter(73)+"(=> value on file="+ze+") must be at least two")
    1259          print("more gridpoints greater than start range="+parameter(71)+"(=>value on file="+zs+")")
     848         print("range end for x-coordinate="+ze+") must be at least two")
     849         print("more gridpoints greater than start range="+zs+")")
    1260850         print(" ")
    1261851         exit
     
    1265855   if (xyc .EQ. 1) then
    1266856      no_layer = (ze-zs)+1
    1267       data = new((/dim,nt,zdim+1,(ye-ys)+1,(xe-xs)+1/),float)
     857      data = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,(xe-xs)+1/),float)
    1268858   end if
    1269859   if (xzc .EQ. 1) then
    1270860      no_layer = (ye-ys)+1
    1271       data = new((/dim,nt,(ze-zs)+1,ydim+1,(xe-xs)+1/),float)
     861      data = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,(xe-xs)+1/),float)
    1272862   end if
    1273863   if (yzc .EQ. 1) then
    1274864      no_layer = (xe-xs)+1
    1275       data = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,xdim+1/),float)
     865      data = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,(xe-xs)+1/),float)
    1276866   end if
    1277867
     
    1299889      lis = start_time_step
    1300890      lie = end_time_step
    1301       los = lays
    1302       loe = laye
     891      los = 0
     892      loe = laye-lays
    1303893   else
    1304       lis = lays
    1305       lie = laye
     894      lis = 0
     895      lie = laye-lays
    1306896      los = start_time_step
    1307897      loe = end_time_step
     
    1314904   n=0
    1315905
    1316    do varn=dim-1,0,1 
    1317      
    1318       data_all = f->$vNam(varn)$
     906   do varn=dim-1,0,1       
    1319907   
    1320908      if (vector .EQ. 1) then   
     
    1328916         check = True
    1329917      end if 
    1330       if (  isvar("var") ) then 
    1331          check = isStrSubset( var,","+vNam(varn)+",")
    1332       end if 
    1333       if (parameter(21) .NE. "variables") then
    1334          var = parameter(21)
     918   
     919      if (var .NE. "all") then
    1335920         check = isStrSubset( var,","+vNam(varn)+"," )
    1336921      end if 
     
    1350935
    1351936         if (xyc .EQ. 1) then
    1352             data(varn,:,:,:,:)=data_all(:,:,ys:ye,xs:xe)
     937            data(varn,:,:,:,:)=f->$vNam(varn)$(:,zs:ze,ys:ye,xs:xe)     
    1353938         end if
    1354939         if ( xzc .eq. 1 ) then
    1355             data(varn,:,:,:,:)=data_all(:,zs:ze,:,xs:xe)
     940            data(varn,:,:,:,:)=f->$vNam(varn)$(:,zs:ze,ys:ye,xs:xe)
    1356941         end if
    1357942         if ( yzc .eq. 1) then
    1358             data(varn,:,:,:,:)=data_all(:,zs:ze,ys:ye,:)
    1359          end if
    1360 
     943            data(varn,:,:,:,:)=f->$vNam(varn)$(:,zs:ze,ys:ye,xs:xe)
     944         end if
    1361945         if (check_vec1) then
    1362             vect1=data_all
     946            vect1=data(varn,:,:,:,:)
    1363947         end if
    1364948         if (check_vec2) then
    1365             vect2=data_all
     949            vect2=data(varn,:,:,:,:)
    1366950         end if
    1367951
     
    1377961      end if
    1378962
    1379       delete(data_all)
    1380 
    1381963   end do
    1382964
    1383    if (n .EQ. 0) then
    1384       print(" ")
    1385       print("The variables 'var=°"+var+"°' do not exist on your input file")
     965   var_input=new(no_var,string)
     966   numb=0
     967   do varn=dim-1,0,1   
     968   
     969      if (vector .EQ. 1) then   
     970         check_vec1 = isStrSubset( vec1,","+vNam(varn)+",")
     971         check_vec2 = isStrSubset( vec2,","+vNam(varn)+",")
     972      end if
     973           
     974      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" .or. vNam(varn) .eq. "zu" .or. vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi" .or. vNam(varn) .eq. "time" .or. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d" .or. vNam(varn) .eq. "x".or. vNam(varn) .eq. "y" .or. vNam(varn) .eq. "zu_xy" .or. vNam(varn) .eq. "zw_xy" .or. vNam(varn) .eq. "zu1_xy" .or. vNam(varn) .eq. "ind_z_xy" .or. vNam(varn) .eq. "y_xz" .or. vNam(varn) .eq. "yv_xz" .or. vNam(varn) .eq. "ind_y_xz" .or. vNam(varn) .eq. "x_yz" .or. vNam(varn) .eq. "xu_yz" .or. vNam(varn) .eq. "ind_x_yz") then
     975         check = False
     976      else
     977         check = True
     978      end if 
     979   
     980      if (var .NE. "all") then
     981         check = isStrSubset( var,","+vNam(varn)+"," )
     982      end if 
     983
     984      if(check) then     
     985         var_input(numb)=vNam(varn)
     986         numb=numb+1     
     987      end if
     988     
     989   end do
     990
     991   if (no_var .EQ. 0) then
     992      print(" ")
     993      print("The variables var='"+var+"' do not exist on your input file;")
     994      print("be sure to have one comma berfore and after each variable")
    1386995      print(" ")
    1387996      exit
     
    13911000      if (v1 .EQ. 0)then
    13921001         print(" ")
    1393          print("Varible for vector-plot ('vec1') must be one of the varibles for plot ('var')")
     1002         print("Component 1 for the vector-plot ('vec1') must be one of the input varibles:")
     1003         print("- "+var_input)
     1004         print("be sure to have one comma berfore and after the variable")
    13941005         print(" ")
    13951006         exit
     
    13981009      if (v2 .EQ. 0)then
    13991010         print(" ")
    1400          print("Varible for vector-plot ('vec2') must be one of the varibles for plot ('var')")
     1011         print("Component 2 for the vector-plot ('vec2') must be one of the input varibles:")
     1012         print("- "+var_input)
     1013         print("be sure to have one comma berfore and after the variable")
    14011014         print(" ")
    14021015         exit
     
    14231036   ; ***************************************************
    14241037
    1425    if (vector .EQ. 1 .AND. parameter(45) .EQ. "plotvec") then
     1038   if (vector .EQ. 1 .AND. plotvec .EQ. "plotvec") then
    14261039      do lo = los, loe                                         
    14271040         do li = lis, lie
     
    14411054      end do
    14421055   end if
    1443 
    1444    check = True
    14451056 
    14461057   do varn=dim-1,0,1
     
    14551066         check = True
    14561067      end if   
    1457       if (  isvar("var") ) then 
    1458          check = isStrSubset( var,","+vNam(varn)+",")
    1459       end if
    1460       if (parameter(21) .NE. "variables") then
    1461          var = parameter(21)
     1068 
     1069      if (var .NE. "all") then
    14621070         check = isStrSubset( var,","+vNam(varn)+"," )
    14631071      end if
    14641072   
    14651073      if(check) then
    1466          print(vNam(varn))
     1074   
    14671075         space=(MaxVal(varn)-MinVal(varn))/24
    14681076 
     
    14961104                        level = "=" + data&z(lo) + "m"
    14971105                     end if
    1498                      cs_res@gsnCenterString = "t=" + data&t(li) +"s  z"+level
     1106                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) +"h  z"+level             
    14991107                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,lo,:,:),cs_res)
    15001108                     if (vector .EQ. 1 .AND. check_vecp) then
     
    15141122                 
    15151123                  if ( sort .eq. "layer" ) then
    1516                      if ( data&z(li) .eq. -1 ) then
     1124                     if ( data&z(li) .eq. -1 ) then
    15171125                        level = "-average"
    15181126                     else
    15191127                        level = "=" + data&z(li) + "m"
    1520                      end if
    1521                      cs_res@gsnCenterString = "t=" + data&t(lo) + "s  z"+ level
     1128                     end if 
     1129                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  z"+ level               
    15221130                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,li,:,:),cs_res)
    15231131                     if (vector .EQ. 1 .AND. check_vecp) then
     
    15481156               
    15491157                  if ( sort .eq. "time" ) then
    1550                      if ( data&z(lo) .eq. -1 ) then
     1158                     if ( data&y(lo) .eq. -1 ) then
    15511159                        level = "-average"
    15521160                     else
    15531161                        level = "=" + data&y(lo) + "m"
    15541162                     end if
    1555                      cs_res@gsnCenterString = "t=" + data&t(li) + "s  y"+ level
     1163                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "s  y"+ level
    15561164                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,lo,:),cs_res)
    15571165                     if (vector .EQ. 1 .AND. check_vecp) then
     
    15711179
    15721180                  if ( sort .eq. "layer" ) then
    1573                      if ( data&z(li) .eq. -1 ) then
     1181                     if ( data&y(li) .eq. -1 ) then
    15741182                        level = "-average"
    15751183                     else
    15761184                        level = "=" + data&y(li) + "m"
    15771185                     end if
    1578                      cs_res@gsnCenterString = "t=" + data&t(lo) + "s  y"+ level
     1186                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "s  y"+ level
    15791187                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,li,:),cs_res)
    15801188                     if (vector .EQ. 1 .AND. check_vecp) then
     
    16051213
    16061214                  if ( sort .eq. "time" ) then
    1607                      if ( data&z(lo) .eq. -1 ) then
     1215                     if ( data&x(lo) .eq. -1 ) then
    16081216                        level = "-average"
    16091217                     else
    1610                         level = "=" + data&z(lo) + "m"
     1218                        level = "=" + data&x(lo) + "m"
    16111219                     end if
    1612                      cs_res@gsnCenterString = "t=" + data&t(li) + "s  x"+ level
     1220                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "s  x"+ level
    16131221                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,:,lo),cs_res)
    16141222                     if (vector .EQ. 1 .AND. check_vecp) then
     
    16281236
    16291237                  if ( sort .eq. "layer" ) then
    1630                      if ( data&z(li) .eq. -1 ) then
     1238                     if ( data&x(li) .eq. -1 ) then
    16311239                        level = "-average"
    16321240                     else
    1633                         level = "=" + data&z(li) + "m"
     1241                        level = "=" + data&x(li) + "m"
    16341242                     end if
    1635                      cs_res@gsnCenterString = "t=" + data&t(lo) + "s  x"+ level
     1243                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "s  x"+ level
    16361244                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,:,li),cs_res)
    16371245                     if (vector .EQ. 1 .AND. check_vecp)then
     
    16601268   ; ***************************************************
    16611269
    1662    if (vector .EQ. 1 .AND. parameter(45) .EQ. "plotvec")then
     1270   if (vector .EQ. 1 .AND. plotvec .EQ. "plotvec")then
    16631271      if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
    16641272         gsn_panel(wks_ps,plot(0:(no_time*no_layer*(no_var+1))-1),(/no_var+1,no_layer*no_time/),cs_resP)
Note: See TracChangeset for help on using the changeset viewer.