Changeset 1110 for palm/trunk/SCRIPTS


Ignore:
Timestamp:
Mar 7, 2013 11:42:45 AM (9 years ago)
Author:
maronga
Message:

updates in nc2vdf

Location:
palm/trunk/SCRIPTS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/nc2vdf

    r1068 r1110  
    1919# Current revisions:
    2020# -----------------
    21 #
     21# adapted for use on desktop machines
     22
    2223# Former revisions:
    2324# -----------------
     
    3031# ------------
    3132# Starting script for nc2vdf. The script does only work on hicegate2, bicegate2,
    32 # uv as well as on the server at imuk.
     33# uv, on the imuk server. It can be adapted for use on any desktop machine.
    3334#------------------------------------------------------------------------------#
    3435
     
    3839    sys="unknown"
    3940
     41    line=""
     42    more $1 | grep "check_workstation" > tmp_mrun
     43    while read line
     44    do
     45      check_workstation=`echo $line | cut -d"=" -s -f2`
     46    done < tmp_mrun
     47
     48    line=""
     49    more $1 | grep "WS_init" > tmp_mrun
     50    while read line
     51    do
     52      WS_init=`echo $line | cut -d"=" -s -f2`
     53    done < tmp_mrun
     54
     55    line=""
     56    more $1 | grep "init_script" > tmp_mrun
     57    while read line
     58    do
     59      vapor_init_path=`echo $line | cut -d"=" -s -f2`
     60    done < tmp_mrun
     61
     62    rm tmp_mrun
    4063
    4164    echo "*** checking hostname..."
     
    6184       check_hlrn=true
    6285    fi
    63 #    if [ $(expr "$HOSTNAME" : "") -eq 1 ] ### insert $HOSTNAME of your workstation here if you are not running vapor on one of the systems above
    64 #    then
    65 #       check_workstation=true
    66 #    fi
     86
     87
    6788
    6889
     
    7192    then
    7293       sys="IMUK"
    73        . /muksoft/packages/vapor/2.1.0/bin/vapor-setup.sh
     94       . /muksoft/packages/vapor/2.2.0/bin/vapor-setup.sh
    7495    fi
    7596
     
    81102       module load ncl
    82103    fi
    83    
    84     if [ $check_workstation == "true" ]
     104
     105    if [ $check_workstation == "True" ]
    85106    then
    86107       sys="workstation"
     108       if [ $WS_init == "True" ]
     109       then
     110          . $vapor_init_path
     111       fi
     112       if [ $WS_load == "True" ]
     113       then
     114          $WS_load_command
     115       fi
    87116    fi
    88117
  • palm/trunk/SCRIPTS/nc2vdf.config

    r1079 r1110  
    1818; Current revisions:
    1919; -----------------
    20 ;
     20; adapted for use on desktop machines
    2121;
    2222; Former revisions:
     
    2424; $Id$
    2525;
    26 ; 1078 2012-12-11 10:44:49Z maronga
    27 ; Minor changes
    28 ;
    29 ; 1067 2012-11-26 10:13:14Z maronga
     26; 1067 2012-11-26 10:13:14Z marong
    3027; Initial revision
    3128;
     
    3431; Configuration file for nc2vdf.
    3532;------------------------------------------------------------------------------!
     33; This configuration file uses NCL syntax.
     34;------------------------------------------------------------------------------!
     35; Define name of output file:
     36    outputfile      = "vaporoutput" +".vdf"
    3637
    3738; Insert number and names of input files
    3839    numberoffiles   = 2
    3940    files           = new( (/numberoffiles/), string)
    40     files(0)        = "../OUTPUT/example_3d.nc"
    41     files(1)        = "../OUTPUT/example_3d.1.nc"
     41    files(0)        = "palm/current_version/JOBS/building/OUTPUT/building_3d.nc"
     42    files(1)        = "palm/current_version/JOBS/building/OUTPUT/building_3d.nc"
     43    ;files(2)        =
     44 ; path from where nc2vdf is called
    4245
    43 ; Insert names of variables to be taken from files specifyed above
     46; Insert names of variables to be taken from files specified above
    4447    alt_varnames = False
    45     ;for using the alternative method (alt_varnames = True):
     48    ; for using the alternative method (alt_varnames = True)
     49    ; e.g. for varnames containing double quotes, get numbers from ncdump:
     50
    4651    ;vars = new( (/numberoffiles,1/), integer)
    4752    ;vars(0,0) = 10
    4853    ;vars(1,0) = 9
    4954
    50     nvars = 2 ;number of variables (per file)
     55    nvars = 2 ; number of variables (per file)
    5156
    52     ;normal method (alt_varnames = False):
     57    ; normal method:
    5358    varString = new( (/numberoffiles,1/), string)
    5459    varString(0,0) = "u"
    5560    varString(1,0) = "w"
    5661
    57 ; specify index of start and end time step? 'False' will include all time steps
     62; Specify index of start and end time step, 'False' will include all time steps
    5863    spec_ts = True
    5964    t_start = 0
    60     t_end   = 10
     65    t_end   = 3
    6166
    6267; Specify a maximum refinement level? 'False' will set the default value.
     
    7176    stretch_level = 999
    7277
     78;------------------------------------------------------------------------------!
     79; Configuration for workstations (none IMUK/HLRN systems)
     80    check_workstation = False
     81                       ; Set check True to run script on none IMUK/HLRN systems.
    7382
    74 ; define name of output file
    75    outputfile = "vaporoutput" +".vdf"
     83    ;WS_init          = False
     84    ;init_script      = /muksoft/packages/vapor/2.2.0/bin/vapor-setup.sh
     85                       ; Note: These lines alway stay comments for NCL
     86                       ; as they are read by the shell script only.
    7687
     88                       ; Set init True if VAPORs initialization script
     89                       ; needs to run on the workstation (most linux systems).
     90                       ; Provide path to script (without quotes; . /path/init.sh).
     91
     92    ;WS_load          = False
     93    ;WS_load_command  = module load vapor ncl
     94                       ; pass any command to the shell
     95
     96    install_path      = "/Applications/VAPOR.app/Contents/MacOS/"
     97                       ; customize VAPOR installation path
     98                       ; when running this script on a (Mac OS) workstation
     99                       ; * will be ignored on HLRN or IMUK systems *
     100
     101;------------------------------------------------------------------------------!
     102
  • palm/trunk/SCRIPTS/nc2vdf.ncl

    r1068 r1110  
    1818; Current revisions:
    1919; -----------------
     20; adapted for use on desktop machines
    2021;
    2122; Former revisions:
     
    4142; order to run this script, NCL version 5.2.0 or higher is required.
    4243; Default setting will be loaded from .nc2vdf.config.
    43 ; Note that on HLRN, vapor is only available on hicegate2, bicegate2 and the UV
    44 ; sytem.
     44; The script does only work on hicegate2, bicegate2,
     45; uv, on the imuk server. It can be adapted for use on any desktop machine.
    4546;------------------------------------------------------------------------------!
    4647
     
    7677    print("*** loading " + dimsizes(files) + ":")
    7778    do i=0,dimsizes(files)-1
    78        print("    " + i + ") " + files(i)) 
     79       print("    " + i + ") " + files(i))
    7980    end do
    8081
     
    8788    sys        = "unknown"
    8889    query      = systemfunc("echo $HOSTNAME")
    89     check_muk  = isStrSubset(query,"muk.uni-hannover.de") 
    90     check_hice = isStrSubset(query,"hicegate2") 
     90    check_muk  = isStrSubset(query,"muk.uni-hannover.de")
     91    check_hice = isStrSubset(query,"hicegate2")
    9192    check_bice = isStrSubset(query,"bicegate2")
    9293    check_huv  = isStrSubset(query,"huv")
    9394    check_buv  = isStrSubset(query,"buv")
    94     check_WS   = isStrSubset(query,"kookaburra") ;*** insert name of your workstation here
     95
    9596
    9697
     
    108109             sys = "HLRN"
    109110             else
    110                 if ( check_WS .eq. True) then
     111                if ( check_workstation .eq. True) then
    111112                print("*** nc2vdf will execute on a workstation PC/Mac")
    112113                sys = "workstation"
    113                 path     = "/Applications/VAPOR.app/Contents/MacOS/" ;*** costomize path for WS
     114                path = install_path
    114115          end if
    115116          end if
     
    121122    end if
    122123
    123    
     124
    124125workpath = systemfunc("echo $PWD") + "/"
    125126
     
    152153
    153154if man then
    154     ;**** Get names of variables wanted to appear in the VDF file, then get their dimensions with min/max x,y,z
     155    ;**** Get names of variables appearing in the VDF file, then get their dimensions with min/max x,y,z
    155156    print(" ")
    156157    print("Choose the *.nc files containing 3D data by typing their indices (seperated by ','). Start with the first files of the timeseries.")
     
    190191
    191192    varNames      = getfilevarnames(f)
    192    
    193    
     193
     194
    194195    if man then
    195196    print(" ")
     
    205206    nvars = dimsizes(vars)
    206207    end if; man
    207    
     208
    208209    if (nofiles .eq. 1) then
    209210    if man then
     
    219220       varString(i,n) = varNames(vars(n))
    220221       end if; man
    221        
     222
    222223       if alt_varnames then
    223224            varString(i,n) = varNames(vars(i,n))
    224225       end if
    225        
     226
    226227       if (vars3d .ne. "") then
    227228       vars3d       = vars3d + ":" + varString(i,n)
     
    234235       dimNames(i,n,:) = getfilevardims(f, varString(i,n))
    235236
    236        
     237
    237238
    238239       time     = f->$dimNames(i,n,0)$
     
    373374end if
    374375
    375        
     376
    376377
    377378;*******************************************************************************
     
    437438
    438439    delete(f)
    439          
     440
    440441    do i=0,nofiles-1
    441442
     
    447448        print(" ")
    448449        file_in(i)    = files_avail(toint(systemfunc("read file; echo $file")))
    449        
     450
    450451    end do
    451452
     
    489490       end do
    490491    end if
    491            
    492            
    493            
     492
     493
     494
    494495    t_end       = dimsizes(time)-1
    495496
    496497
    497    
     498
    498499    end if
    499500
     
    539540         dims2d     = getfilevardimsizes(f,varString2d(n))
    540541         dimNames2d(n,:) = getfilevardims(f,varString2d(n))
    541          
     542
    542543
    543544      end do
     
    556557         end do
    557558      end do
    558       delete(varNames2d)     
     559      delete(varNames2d)
    559560   end if
    560561
Note: See TracChangeset for help on using the changeset viewer.