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

Annotation of /MITgcm/utils/scripts/xplodemnc

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


Revision 1.4 - (hide annotations) (download)
Fri Aug 14 21:07:44 2009 UTC (14 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63d, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint62, checkpoint63, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61v, checkpoint61w, checkpoint61u, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.3: +8 -3 lines
Ryan modif's to glue grid files: WARNING: this does not preserve all
 the grid variables (drF, drC + some others 1.D vectors are lost).

1 jmc 1.4 #! /usr/bin/env bash
2     #
3     # $Header: $
4     # $Name: $
5    
6 baylor 1.1 # 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 baylor 1.3 DEBUG="--dbg_lvl=0"
12 baylor 1.2
13 baylor 1.1 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 baylor 1.2 # Finding all the multidimensional variables
25     varls=$(ncdump -h $somefile | grep "double\|float" | grep , )
26 baylor 1.1 IFS=';'
27     vars=
28     for somevar in ${varls}
29     do
30     somevar1=${somevar%(*}
31     somevar1=${somevar1#*double }
32 baylor 1.2 somevar1=${somevar1#*float }
33 baylor 1.3 # echo $somevar1
34 baylor 1.1 vars=${vars}$somevar1' '
35     done
36     IFS=' '
37 jmc 1.4 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 baylor 1.1 for somevar in $vars
41     do
42 baylor 1.2 ncks $DEBUG -v $somevar $somefile $somevar.$somefile
43 baylor 1.1 done
44     done

  ViewVC Help
Powered by ViewVC 1.1.22