Ignore:
Timestamp:
Mar 6, 2015 8:22:12 AM (7 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/cross_sections.ncl

    r1248 r1559  
    66
    77;***************************************************
    8 ; load .ncl.config or .ncl.config.default
     8; Checking the kind of the script
    99;***************************************************
    1010
     
    1212local script
    1313begin
    14    script="cross_section"
     14   script = "cross_section"
    1515   return(script)
    1616end
    1717
    18 if (isfilepresent("$PALM_BIN/../../.ncl.config")) then
     18;***************************************************
     19; Retrieving the NCL version used
     20;***************************************************
     21   
     22ncl_version_ch = systemfunc("ncl -V")
     23ncl_version    = stringtofloat(ncl_version_ch)
     24
     25;***************************************************
     26; Function for checking file existence in dependence
     27; on NCL version
     28;***************************************************
     29
     30function file_exists(version:string,file_name:string)
     31begin
     32   if( version .EQ. "6.2.1" ) then
     33      existing = fileexists(file_name)
     34   else
     35      existing = isfilepresent(file_name)
     36   end if
     37   return(existing)
     38end
     39 
     40;***************************************************
     41; load .ncl.config or .ncl.config.default
     42;***************************************************
     43   
     44file_name ="$PALM_BIN/../../.ncl.config"
     45existing_file = file_exists(ncl_version_ch,file_name)
     46
     47if (existing_file) then
    1948   loadscript("$PALM_BIN/../../.ncl.config")
    2049else
    21   if (isfilepresent("$PALM_BIN/NCL/.ncl.config.default")) then
    22      loadscript( "$PALM_BIN/NCL/.ncl.config.default")
    23   else
     50   file_name = "$PALM_BIN/NCL/.ncl.config.default"
     51   existing_file = file_exists(ncl_version_ch,file_name)
     52   if (existing_file) then
     53      loadscript( "$PALM_BIN/NCL/.ncl.config.default")
     54   else
    2455      palm_bin_path = getenv("PALM_BIN")
    2556      print(" ")
     
    3263      exit
    3364   end if
    34 end if    
     65end if
    3566
    3667begin
    37 
    38    ;***************************************************
    39    ; Retrieving the NCL version used
    40    ;***************************************************
    41    
    42    ncl_version_ch = systemfunc("ncl -V")
    43    ncl_version    = stringtofloat(ncl_version_ch)
    4468
    4569   ; ***************************************************
Note: See TracChangeset for help on using the changeset viewer.