source: tags/ORCHIDEE_1_9_5/ORCHIDEE_OL/Utilitaire/Regrid_restart/script_regrid @ 8

Last change on this file since 8 was 8, checked in by orchidee, 14 years ago

import first tag equivalent to CVS orchidee_1_9_5 + OOL_1_9_5

File size: 2.4 KB
Line 
1#!/bin/ksh
2
3set -vx
4
5###########################################################################################
6# ajoute_bord.py
7###########################################################################################
8# usage :
9# prompt> script_regrid restart_file_to_keep_the_grid.nc restart_file_to_get_the_values.nc
10
11# example in ksh shell :
12# > script_regrid CM1414A_20001231_sechiba_rest.nc CM5PIRC11_29901231_sechiba_rest.nc > shell_test_script_regrid_SECHIBA 2>&1
13###########################################################################################
14
15
16PATH_FILE_IN_TO_GRID=$1
17FILE_IN_TO_GRID=$( basename $1 )
18DIR_IN_TO_GRID=$( dirname $1 )
19
20PATH_FILE_IN_VALUES=$2
21FILE_IN_VALUES=$( basename $2 )
22DIR_IN_VALUES=$( dirname $2 )
23
24if [ X${DIR_IN_TO_GRID} != X. ] ; then
25    cp ${1} .
26fi
27if [ X${DIR_IN_VALUES} != X. ] ; then
28    cp ${2} .
29fi
30
31# Add true CF convention compatible with CDAT cdms library
32# --------------------------------------------------------
33CF_restart.py ${FILE_IN_TO_GRID}
34CF_FILE_IN_TO_GRID=CF_${FILE_IN_TO_GRID}
35
36CF_restart.py ${FILE_IN_VALUES}
37CF_FILE_IN_VALUES=CF_${FILE_IN_VALUES}
38
39
40
41# Interpol the CF restart
42# -----------------------
43# For SECHIBA restart files, we delete routing variables :
44# 1) with restget calls order in the code :
45# routingcounter,routingarea,routetogrid,routetobasin,basinid,topoindex,fastres,slowres,streamres,lakeres,
46# previous_outflow,lakeinflow,returnflow,riverflow,coastalflow,hydrographs,
47# runoff_route,drainage_route,evapot_route,precip_route,humrel_route,totnobio_route,vegtot_route
48# 2) with alphabetic order :
49# basinid, coastalflow,
50# drainage_route, evapot_route, fastres, humrel_route, hydrographs, lakeinflow, lakeres,
51# precip_route, previous_outflow, returnflow, riverflow, routetobasin, routetogrid, routingarea,
52# runoff_route, slowres, streamres, topoindex, totnobio_route, vegtot_route
53
54restart_interpol.py ${CF_FILE_IN_TO_GRID} ${CF_FILE_IN_VALUES}
55regrid_FILE_OUT=regrid_${CF_FILE_IN_VALUES}
56
57# Change CF convention to restcom axes
58# ------------------------------------
59ncrename -d lat,y -d lon,x -d lev,z ${regrid_FILE_OUT}
60ncks -O -a -x -v lat,lon,lev,bounds_lat,bounds_lon ${regrid_FILE_OUT} ${regrid_FILE_OUT}
61
62# Name of the output file
63# -----------------------
64FILE_OUT=grille_${regrid_FILE_OUT}
65
66# Correct mask of the output file
67# -------------------------------
68ajoute_bords.py ${FILE_IN_TO_GRID} ${regrid_FILE_OUT} ${FILE_OUT}
69
Note: See TracBrowser for help on using the repository browser.