Changeset 44 for trunk/tools


Ignore:
Timestamp:
01/31/08 07:59:54 (16 years ago)
Author:
ericg
Message:

Clean up of make_1mm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/netCDF_scripts/make_1mm

    r43 r44  
    22# -*- Mode: sh -*- 
    33# 
    4 #  Script to build 1mm and annual mean from time serie 
     4#  Script to build 1mm and full record annual mean from monthly time serie 
    55# 
    66#  Uses nco tools 
     
    88usage() { 
    99echo 
    10 echo "usage : make_1mm [-d] [-g] [-v <field1>,<field2>...] [-t <record name>] [-g <grid>] [-m] <file> <nyears>" 
     10echo "usage : make_1mm [-d] [-v <field1>,<field2>...] [-t <record name>] [-m] <file> <nyears>" 
     11echo "        -d : toggle debug mode" 
     12echo "        -v : specify fields to work on" 
     13echo "        -t : specify time record name (should be detected automatically)" 
     14echo "        -m : do not make full record time mean" 
     15echo "        <file>   : netcdf post-it format file" 
     16echo "        <nyears> : number of years in file" 
    1117echo 
    1218} 
     
    2026# 
    2127 
    22 while getopts g:dhv:t:m name 
     28while getopts dhv:t:m name 
    2329do 
    2430    case $name in 
    2531        d) set -x ;; 
    26         g) type="$OPTARG";; 
    2732        v) fields="$OPTARG" ;; 
    2833        t) timef="$OPTARG" ;; 
     
    3641 
    3742# 
    38 # so that $1 is root 
     43# decode file name 
    3944# 
    4045shift `expr $OPTIND - 1` 
     
    6570echo "Processing: $enam $ave $year1 $year2 $ndates $type" 
    6671 
    67 case $type in 
    68     t30) long="nav_lon"  
    69             lati="nav_lat"   
    70            time="time_counter" ;; 
    71     lmdz*) long="lon"  
    72             lati="lat"   
    73             time="time_counter" ;; 
    74     reg1) long="lon"  
    75             lati="lat"   
    76             time="time" ;; 
    77     t42) long="lon"  
    78             lati="lat"   
    79             time="time" ;; 
    80     t62) long="lon"  
    81            lati="lat"   
    82            time="time" ;; 
    83     umat) long="longitude"  
    84             lati="latitude"   
    85             time="t" ;; 
    86     umau) long="longitude"  
    87             lati="latitude"   
    88             time="t" ;; 
    89     reg1mtrop) long="longitude"  
    90             lati="latitude"   
    91             time="t" ;; 
    92     *) long="nav_lon"  
    93        lati="nav_lat"   
    94        time=`ncdump -h ${file} | grep UNLIMITED | awk '{print $1}'` ;; 
    95 esac  
     72# detect time dimension 
     73 
     74time=`ncdump -h ${file} | grep UNLIMITED | awk '{print $1}'` 
    9675time=${timef:-$time} 
    9776fields=${fields:-"-x -v $long,$lati"} 
     
    11291 
    11392# 
    114 PATH=$PATH:/usr/local/netcdf/bin:/u/rech/eee/reee217/bin 
    115 # 
    11693out1m=${enam}_${aveoum}_01_12_${year1}-${year2}_$type.nc 
    11794outmean=${enam}_${ndates}y_${year1}_${year2}_$type.nc 
    11895# 
    11996optg="-O" 
    120 grid=0 
    121 if [ $grid -eq 1 ] ; then 
    122 # get grid 
    123     ncks -O -v $lati,$long ${file} $out1m || echo 'no grid' 
    124     optg="-A" 
    125 fi 
    12697 
    12798m_list="00 01 02 03 04 05 06 07 08 09 10 11" 
Note: See TracChangeset for help on using the changeset viewer.