/[MITgcm]/MITgcm/utils/scripts/xplodemnc
ViewVC logotype

Contents of /MITgcm/utils/scripts/xplodemnc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download)
Tue Oct 25 13:07:16 2011 UTC (12 years, 7 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.4: +2 -2 lines
replace grep by egrep to make this script also work with stupid SunOS

1 #! /usr/bin/env bash
2 #
3 # $Header: /u/gcmpack/MITgcm/utils/scripts/xplodemnc,v 1.4 2009/08/14 21:07:44 jmc Exp $
4 # $Name: $
5
6 # This is a shell script to separate an MITgcm mnc output file into
7 # one file per multi-dimensional variable.
8 # The file should be in one directory, where this script is run.
9 # The resulting files will be in the same directory.
10
11 DEBUG="--dbg_lvl=0"
12
13 inone=$1
14 inone=${1:?"You must input an mnc filename to be xploded"}
15
16 for somefile in $@
17 do
18 echo Extracting from file $somefile...
19 if [ ! -s $somefile ]; then
20 echo "Error: $somefile is missing or empty"
21 exit 1
22 fi
23
24 # Finding all the multidimensional variables
25 varls=$(ncdump -h $somefile | egrep "double|float" | egrep , )
26 IFS=';'
27 vars=
28 for somevar in ${varls}
29 do
30 somevar1=${somevar%(*}
31 somevar1=${somevar1#*double }
32 somevar1=${somevar1#*float }
33 # echo $somevar1
34 vars=${vars}$somevar1' '
35 done
36 IFS=' '
37 withIter=$(ncdump -h $somefile | grep -c 'int iter(' )
38 if [ $withIter -gt 0 ]; then vars=${vars}iter ; fi
39 echo Variables to extract: $vars
40 for somevar in $vars
41 do
42 ncks $DEBUG -v $somevar $somefile $somevar.$somefile
43 done
44 done

  ViewVC Help
Powered by ViewVC 1.1.22