source:
utils/tools/DOMAINcfg/xtrac_namelist.bash
Last change on this file was 13390, checked in by mathiot, 4 years ago | |
---|---|
|
|
File size: 1.5 KB |
Rev | Line | |
---|---|---|
[13341] | 1 | #!/bin/bash |
2 | ##################################################################### | |
3 | # | |
4 | # history: JM Molines (MEOM/IGE/DRAKKAR) XX/2019: DRAKKAR version | |
5 | # P Mathiot (CryoDyn/IGE/DRAKKAR) 07/2020: added in NEMO | |
6 | # | |
7 | # purpose: re-generate the namelist used to build a domain_cfg.nc file | |
8 | # assuming namelist_cfg variable has been added into via | |
9 | # the dom_doc.exe tools | |
10 | # | |
11 | ##################################################################### | |
12 | # | |
13 | # function to extract namelist | |
14 | xtrac_namelist() { | |
15 | domain_cfg=$1 | |
16 | namelist_cfg=$2 | |
[13345] | 17 | #ncdump -v namelist_cfg $domain_cfg | tr -d '"' \ |
18 | # | tr -d '\\' \ | |
19 | # | sed -e 's/ *,$//' \ | |
20 | # -e 's/;$//' \ | |
21 | # -e '1,/namelist_cfg =/d' \ | |
22 | # -e '$d' -e 's/^..//' | |
23 | ncdump -v namelist_cfg $domain_cfg \ | |
[13341] | 24 | | tr -d '\\' \ |
[13345] | 25 | | sed -e 's/^ "//' \ |
26 | -e 's/ *",$//' \ | |
[13341] | 27 | -e 's/;$//' \ |
28 | -e '1,/namelist_cfg =/d' \ | |
[13345] | 29 | -e '$d' |
[13341] | 30 | } |
31 | # | |
32 | # main script | |
33 | # | |
34 | if [ $# != 2 ]; then echo 'usage xtract_namelist.bash [domain_cfg.nc file name] [namelist_output name]'; exit 42; fi | |
35 | ||
36 | xtrac_namelist $1 > $2 | |
37 | ||
38 | exit $? |
Note: See TracBrowser
for help on using the repository browser.