/[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.2 - (hide annotations) (download)
Tue Oct 24 15:44:04 2006 UTC (17 years, 7 months ago) by baylor
Branch: MAIN
Changes since 1.1: +7 -2 lines
Fixed gluemnc and xplodemnc (finally!!).  Now works with multiple tiles in X and Y directions, as well as with float and double variable precision.

It's not terribly fast, but allows combination of all *t0??.nc tiles to a single *.glob.nc file.  Works with dynamics output and tave output as well.  I don't know if it works for pickup files, but it may.

It should be possible to -omp multi-thread it by changing the -DEBUG flag to include the omp directives if your NCO operators were compiled with omp support.

Happy gluing!

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

  ViewVC Help
Powered by ViewVC 1.1.22