Ignore:
Timestamp:
Mar 6, 2015 8:22:12 AM (9 years ago)
Author:
heinze
Message:

Changes to allow for using NCL version 6.2.1 and higher. Backward compatibility is also ensured.

File:
1 edited

Legend:

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

    r1248 r1559  
    33load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
    44load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
    5  
     5
     6;***************************************************
     7; Checking the kind of the script
     8;***************************************************
     9
     10function which_script()
     11local script
     12begin
     13   script = "timeseries"
     14   return(script)
     15end
     16
     17;***************************************************
     18; Retrieving the NCL version used
     19;***************************************************
     20   
     21ncl_version_ch = systemfunc("ncl -V")
     22ncl_version    = stringtofloat(ncl_version_ch)
     23
     24;***************************************************
     25; Function for checking file existence in dependence
     26; on NCL version
     27;***************************************************
     28
     29function file_exists(version:string,file_name:string)
     30begin
     31   if( version .EQ. "6.2.1" ) then
     32      existing = fileexists(file_name)
     33   else
     34      existing = isfilepresent(file_name)
     35   end if
     36   return(existing)
     37end
     38 
    639;***************************************************
    740; load .ncl.config or .ncl.config.default
    841;***************************************************
    9 
    10 function which_script()
    11 local script
    12 begin
    13    script="timeseries"
    14    return(script)
    15 end
    16 
    17 if (isfilepresent("$PALM_BIN/../../.ncl.config")) then
     42   
     43file_name ="$PALM_BIN/../../.ncl.config"
     44existing_file = file_exists(ncl_version_ch,file_name)
     45
     46if (existing_file) then
    1847   loadscript("$PALM_BIN/../../.ncl.config")
    1948else
    20   if (isfilepresent("$PALM_BIN/NCL/.ncl.config.default")) then
    21      loadscript( "$PALM_BIN/NCL/.ncl.config.default")
    22   else
     49   file_name = "$PALM_BIN/NCL/.ncl.config.default"
     50   existing_file = file_exists(ncl_version_ch,file_name)
     51   if (existing_file) then
     52      loadscript( "$PALM_BIN/NCL/.ncl.config.default")
     53   else
    2354      palm_bin_path = getenv("PALM_BIN")
    2455      print(" ")
     
    3162      exit
    3263   end if
    33 end if   
    34    
     64end if
     65
    3566begin
    36 
    37    ;***************************************************
    38    ; Retrieving the NCL version used
    39    ;***************************************************
    40    
    41    ncl_version_ch = systemfunc("ncl -V")
    42    ncl_version    = stringtofloat(ncl_version_ch)
    4367
    4468   ;***************************************************
Note: See TracChangeset for help on using the changeset viewer.