Changeset 51 for trunk/src


Ignore:
Timestamp:
04/29/11 13:56:15 (13 years ago)
Author:
pinsard
Message:

add time parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/compute_erai_daily_region_2d.sh

    r50 r51  
    1616# :: 
    1717# 
    18 #  $ compute_erai_daily_region_2d.sh [--debug] [--diff_cmd arg] 
     18#  $ compute_erai_daily_region_2d.sh [--debug] [--diff_cmd arg] -b yyyymmdd -e yyyymmdd 
    1919# 
    2020# DESCRIPTION 
     
    2323# .. option:: --diff_cmd <arg> 
    2424# 
    25 #    by default :samp:`ncflint` command is used to compute difference between NetCDF files 
    26 # 
    27 #    if :samp:`cdo` is specified here, this command will be used instead. 
     25#    By default :samp:`ncflint` command is used to compute difference between NetCDF files 
     26# 
     27#    If :samp:`cdo` is specified here, this command will be used instead. 
    2828# 
    2929# .. option:: --debug 
    3030# 
    31 #    if this option is set, :samp:`ncdump -v time` will be added to log file 
    32 # 
    33 # 
    34 # Put in ${PROJECT_ID} ERA-Intermin reference files 
     31#    If this option is set, :samp:`ncdump -v time` will be added to log file 
     32# 
     33# .. option:: -b beginning date <yyyymmdd> 
     34# .. option:: -e end date <yyyymmdd> 
     35# 
     36# Put in ${PROJECT_ID} ERA-Intermin reference files. 
    3537# 
    3638# Log file is written on :file:`${PROJECT_LOG}/compute_erai_daily_region_2d.log.{YYYYMMDDTHHMMSSZ}` 
     
    7880# you just have to run this tool :: 
    7981# 
    80 #  $ compute_erai_daily_region_2d.sh 
     82#  $ compute_erai_daily_region_2d.sh -b 19890101 -e 20091231 
    8183# 
    8284# And look at log file with :: 
     
    8587# 
    8688# and of course on files in ${PROJECT_ID}. 
    87 # 
    8889# 
    8990# SEE ALSO 
     
    115116# ==== 
    116117# 
     118# adjust yyyymmddb_min and yyyymmddb_max 
     119# 
    117120# trouble with cdo reference (extra %23name in generated url using sphinx1.0.7) 
    118121# 
    119122# minimize use of generic characters (*) to avoid ambiguity 
    120123# 
    121 # parametrisation of year min and year max 
    122 # 
    123124# split get and process files 
    124125# 
     
    135136#  ncrcat: WARNING Intra-file non-monotonicity. Record coordinate "time" does not monotonically decrease between (input file /homedata/pinsard/log//compute_erai_daily_region_2d.20110126T154235Z.temp//temp_int_str_199012.nc record indices: 29, 30) (output file /homedata/pinsard/tropflux_d//erai_TROP_1d_19900101_19901231_str_gridOrig.nc record indices 363, 364) record coordinate values -0.000278, -0.000278 
    136137# 
    137 # 
    138138#  this seems to be solved by using cdo instead of ncflint. to be confirmed ! 
    139 # 
    140139# 
    141140# no files *19890101* in /bdd/ERAI/NETCDF/GLOBAL_075/4xdaily/FC_SF/1989/01/ : 
     
    157156# 
    158157# $URL$ 
     158# 
     159# - fplod 20110429T114649Z aedon.locean-ipsl.upmc.fr (Darwin) 
     160# 
     161#   * add -b and -e parameters 
    159162# 
    160163# - fplod 20110203T101720Z aedon.locean-ipsl.upmc.fr (Darwin) 
     
    214217   AIX|IRIX64) 
    215218      echo "www : no specific posix checking" 
     219      date_cmd=date 
     220   ;; 
     221   Darwin) 
     222      set -o posix 
     223      date_cmd=gdate 
     224   ;; 
     225   Linux) 
     226      set -o posix 
     227      date_cmd=date 
    216228   ;; 
    217229   *) 
     
    226238log_date=$(date -u +"%Y%m%dT%H%M%SZ") 
    227239# 
    228 usage=" Usage : ${command} --debug --diff_cmd [ncflint|cdo]" 
     240usage=" Usage : ${command} [--debug] [--diff_cmd [ncflint|cdo]] -b yyyymmdd -e yyyymmdd" 
    229241# 
    230242hostname=$(hostname) 
     243# 
     244yyyymmddb_min=19890101 
     245yyyymmdde_max=20091231 
     246# 
    231247# default 
    232248diff_cmd=ncflint 
    233249debug=0 
    234 # 
    235 minargcount=0 
     250yyyymmddb=19890101 
     251yyyymmdde=20091231 
     252# 
     253minargcount=4 
    236254if [ ${#} -lt ${minargcount} ] 
    237255then 
     
    250268      --diff_cmd) 
    251269         diff_cmd=${2} 
     270         shift 
     271      ;; 
     272      -b) 
     273         # first date to get 
     274         yyyymmddb=${2} 
     275         shift 
     276      ;; 
     277      -e) 
     278         # last date to get 
     279         yyyymmdde=${2} 
    252280         shift 
    253281      ;; 
     
    264292# 
    265293set -u 
     294# check parameters 
     295# 
     296${date_cmd} -d "${yyyymmddb}" > /dev/null 
     297status_date=${?} 
     298if [ ${status_date} -ne 0 ] 
     299then 
     300     echo "${command} : eee : yyyymmddb ${yyyymmddb} argument invalid" 
     301     exit 1 
     302fi 
     303unset status_date 
     304# 
     305if [[ "${yyyymmddb}" < "${yyyymmddb_min}" ]] 
     306then 
     307     echo "${command} : eee : yyyymmddb ${yyyymmddb} must be equal or greater than ${yyyymmddb_min}" 
     308     exit 1 
     309fi 
     310# 
     311${date_cmd} -d "${yyyymmdde}" > /dev/null 
     312status_date=${?} 
     313if [ ${status_date} -ne 0 ] 
     314then 
     315     echo "${command} : eee : yyyymmdde ${yyyymmdde} argument invalid" 
     316     exit 1 
     317fi 
     318unset status_date 
     319# 
     320if [[ "${yyyymmdde}" > "${yyyymmdde_max}" ]] 
     321then 
     322     echo "${command} : eee : yyyymmdde ${yyyymmdde} must be lower or equal to ${yyyymmdde_max}" 
     323     exit 1 
     324fi 
     325# 
     326# 
     327if [[ "${yyyymmdde}" < "${yyyymmddb}" ]] 
     328then 
     329     echo "${command} : eee : yyyymmdde ${yyyymmdde} must be equal or greater than yyyymmddb ${yyyymmddb}" 
     330     exit 1 
     331fi 
     332#  
    266333# test if diff_cmd valid 
    267334case ${diff_cmd} in 
     
    344411maxlon=360. 
    345412reg=TROP 
    346 yearmin=1989 
    347 yearmax=2009 
    348 monthmin=1 
    349 monthmax=12 
     413yearmin=$(${date_cmd} -d "${yyyymmddb}" +%Y) 
     414yearmax=$(${date_cmd} -d "${yyyymmdde}" +%Y) 
     415monthmin=$(${date_cmd} -d "${yyyymmddb}" +%m) 
     416monthmax=$(${date_cmd} -d "${yyyymmdde}" +%m) 
    350417cmonthmin=$(printf "%2.2d" ${monthmin}) 
    351418cmonthmax=$(printf "%2.2d" ${monthmax}) 
Note: See TracChangeset for help on using the changeset viewer.