source: trunk/libIGCM/libIGCM_post/IGCM_Patch_20091118_mask.ksh @ 494

Last change on this file since 494 was 373, checked in by sdipsl, 14 years ago

Remove libIGCM_sys_claude.ksh and libIGCM_sys_calculo.ksh
Update/homogenize all headers usgin the new fixed-length keyword syntax regarding properties keywords
$Rev:: 13 i $: Revision of last commit
$Author:: harry $: Author of last commit
$Date:: 2006-03-15 02:33:03 -0500 (Wed, 15 Mar 2006) $: Date of last commit
Add / update original author and contact when missing

  • Property svn:executable set to *
  • Property svn:keywords set to Revision Author Date
File size: 4.2 KB
RevLine 
[201]1#!/bin/ksh
2
[257]3#**************************************************************
4# Author: Arnaud Caubel
[373]5# Contact: Arnaud.Caubel__at__lsce.ipsl.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
[257]9# IPSL (2009)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
[201]14#------------------------------------------------------------
15# Add mask from meshmask file to oceanic variables
16#------------------------------------------------------------
17
18function IGCM_Patch_20091118_mask {
19
20    IGCM_debug_PushStack "IGCM_Patch_mask" $@
21
22    [ -f ${config_UserChoices_JobName}_mesh_mask.nc ] || IGCM_sys_Get ${R_SAVE}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc .
23
24    filename=${1}
25
26    chaineT=${filename%%'grid_T'*}
27    chaineU=${filename%%'grid_U'*}
28    chaineV=${filename%%'grid_V'*}
29    chaineW=${filename%%'grid_W'*}
30    chaineIce=${filename%%'icemod'*}
[242]31    chaineTrc=${filename%%'ptrc_T'*}
32    chaineDia=${filename%%'diad_T'*}
[201]33
34    if [ ${filename} != ${chaineT} ]; then
35        mask='tmask' ; depth='deptht'
36    elif [ ${filename} != ${chaineU} ]; then
37        mask='umask' ; depth='depthu'
38    elif [ ${filename} != ${chaineV} ]; then
39        mask='vmask' ; depth='depthv'
40    elif [ ${filename} != ${chaineW} ]; then
41        mask='tmask' ; depth='depthw'
42    elif [ ${filename} != ${chaineIce} ]; then
43        mask='tmask' ; depth='deptht'
[242]44    elif [ ${filename} != ${chaineTrc} ]; then
45        mask='tmask' ; depth='deptht'
46    elif [ ${filename} != ${chaineDia} ]; then
47        mask='tmask' ; depth='deptht'
[201]48    fi
49
[257]50    #============================================
51    # Remove nav_lon, nav_lat file
[201]52    IGCM_sys_ncks -Oh -x -v nav_lon,nav_lat ${filename} file1.nc
53
[257]54    #============================================
55    # Extract mask variable
[201]56    IGCM_sys_ncks -Oh -v ${mask} ${config_UserChoices_JobName}_mesh_mask.nc mask3D.nc
57
[257]58    #============================================
59    # Rename deptht dimension
[201]60    IGCM_sys_ncrename -Oh -d z,${depth} mask3D.nc
61
[257]62    #============================================
63    # Remove single dimension t
[201]64    IGCM_sys_ncwa -Oh -a t mask3D.nc mask3D.nc
65
[257]66    #============================================
67    # Create mask2D
[201]68    IGCM_sys_ncks -Oh -d ${depth},0,0 mask3D.nc mask2D.nc
69    IGCM_sys_ncwa -Oh -a ${depth} mask2D.nc mask2D.nc
[207]70    IGCM_sys_ncrename -h -v ${mask},mask2D mask2D.nc
[201]71
[257]72    #============================================
73    # Append mask (2D) to file1.nc
[201]74    IGCM_sys_ncks -Ah -c -v mask2D mask2D.nc file1.nc
75
76    if [ ${filename} = ${chaineIce} ]; then
77
[257]78        #============================================
79        # Append mask (3D) only for oceanic files
[201]80        IGCM_sys_ncks -Ah -v ${mask} mask3D.nc file1.nc
[207]81        IGCM_sys_ncrename -h -v ${mask},mask3D file1.nc
[201]82
[257]83        #============================================
84        # Add record dimension only for oceanic files
[201]85        IGCM_sys_ncecat -Oh file1.nc file1.nc
86
[257]87        #============================================
88        # Apply mask 3D only for oceanic files
[311]89        IGCM_sys_ncwa -Oh -a record -B 'mask3D==1' file1.nc file2.nc
90        IGCM_sys_Rm file1.nc
91        IGCM_sys_Mv file2.nc file1.nc
[201]92
[311]93
[201]94    fi
95
[257]96    #============================================
97    # Add record dimension
[201]98    IGCM_sys_ncecat -Oh file1.nc file1.nc
99
[257]100    #============================================
101    # Apply mask 2D
[207]102    IGCM_sys_ncwa -Oh -b -a record -B 'mask2D==1' file1.nc file1.nc
[201]103
[257]104    #============================================
105    # Permute record dimension in time_counter dimension
[207]106    IGCM_sys_ncpdq -Oh -a time_counter,record file1.nc file1.nc
107    IGCM_sys_ncwa -Oh -a record file1.nc file1.nc
108
[257]109    #============================================
110    # Remove mask
[201]111    IGCM_sys_ncks -Oh -x -v mask2D,mask3D file1.nc file_mask.nc
112
[257]113    #============================================
114    # Add nav_lon nav_lat
[201]115    IGCM_sys_ncks -Ah -v nav_lon,nav_lat ${filename} file_mask.nc
116
[257]117    #============================================
118    # Cleaning
[201]119    IGCM_debug_Verif_Exit_Post
120    IGCM_sys_Mv file_mask.nc ${filename}
121    IGCM_sys_Rm mask3D.nc mask2D.nc file1.nc
122   
123    IGCM_debug_PopStack "IGCM_Patch_mask"
124}
Note: See TracBrowser for help on using the repository browser.