source: trunk/libIGCM/libIGCM_post/IGCM_Patch_20140801_ncks_cdo.ksh @ 1572

Last change on this file since 1572 was 1107, checked in by aclsce, 10 years ago

Modifed to avoid error due to the use of ncks on non existing files.

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Date Author Rev
File size: 2.8 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Marie-Alice Foujols
5# Contact: Marie-Alice.Foujols__at__ipsl.jussieu.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
9# IPSL (2009)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
14#------------------------------------------------------------
15# ncks CPL files for 1D frequency, ncra for 1M averaged files
16#------------------------------------------------------------
17
18function IGCM_Patch_20140801_ncks_cdo {
19    IGCM_debug_PushStack "IGCM_Patch_ncks_ncra" $@
20
21    PREFIX=TEMPO
22    if [ -f FIRST_TIME_CPL ] ; then
23       echo FIRST_TIME_CPL exists
24    else
25       # create FIRST_TIME_CPL file
26       date > FIRST_TIME_CPL
27
28       # Get date from directory name
29       DateDeb=$( basename $(pwd) | awk -F _ '{ print $2}' )
30       DateDeb=$( IGCM_date_ConvertFormatToHuman ${DateDeb} )
31       
32       rm -f ${PREFIX}_*_cpl_*.nc
33
34       list_file_atm=$( find . \( -name "S*lmdz.x*.nc" -o -name "C*lmdz.x*.nc" -o -name "S*LMDZ*.nc" -o -name "C*LMDZ*.nc" \) )
35
36       for file in ${list_file_atm} 
37       do
38           IGCM_sys_ncks -A ${file} ${PREFIX}_1D_cpl_atm.nc  > /dev/null 2>&1
39       done
40       rm -f S*lmdz.x*.nc C*lmdz.x*.nc S*LMDZ*.nc C*LMDZ*.nc
41
42       ## Correctly defines the time axis for CDO
43       # DateDeb is first date of the file, not start date of run
44       # (according to time var in OASIS files)
45       #
46       ncatted \
47           -a axis,time,c,c,"T"                                  \
48           -a long_name,time,c,c,"Time axis"                     \
49           -a title,time,c,c,"Time"                              \
50           -a calendar,time,c,c,"noleap"                         \
51           -a units,time,c,c,"seconds since ${DateDeb} 00:00:00" \
52           -a time_origin,time,c,c,"${DateDeb} 00:00:00"         \
53           ${PREFIX}_1D_cpl_atm.nc
54
55       for file in O*oceanx*.nc
56       do
57           IGCM_sys_ncks -A ${file} ${PREFIX}_1D_cpl_oce.nc   > /dev/null 2>&1
58       done
59       rm -f O*oceanx*.nc
60
61       ncatted \
62           -a axis,time,c,c,"T"                                  \
63           -a long_name,time,c,c,"Time axis"                     \
64           -a title,time,c,c,"Time"                              \
65           -a calendar,time,c,c,"noleap"                         \
66           -a units,time,c,c,"seconds since ${DateDeb} 00:00:00" \
67           -a time_origin,time,c,c,"${DateDeb} 00:00:00"         \
68           ${PREFIX}_1D_cpl_oce.nc
69    fi
70
71    # Monthly average
72    IGCM_sys_cdo monavg ${PREFIX}_1D_cpl_atm.nc  ${PREFIX}_1M_cpl_atm.nc
73    IGCM_sys_cdo monavg ${PREFIX}_1D_cpl_oce.nc  ${PREFIX}_1M_cpl_oce.nc
74   
75    IGCM_debug_PopStack "IGCM_Patch_ncks_ncra"
76}
Note: See TracBrowser for help on using the repository browser.