1 |
#!/bin/bash |
#! /usr/bin/env bash |
2 |
|
# |
3 |
|
# $Header$ |
4 |
|
# $Name$ |
5 |
|
|
6 |
# This is a shell script to separate an MITgcm mnc output file into |
# This is a shell script to separate an MITgcm mnc output file into |
7 |
# one file per multi-dimensional variable. |
# one file per multi-dimensional variable. |
8 |
# The file should be in one directory, where this script is run. |
# The file should be in one directory, where this script is run. |
33 |
# echo $somevar1 |
# echo $somevar1 |
34 |
vars=${vars}$somevar1' ' |
vars=${vars}$somevar1' ' |
35 |
done |
done |
|
echo Variables to extract: $vars iter |
|
36 |
IFS=' ' |
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 |
for somevar in $vars |
41 |
do |
do |
42 |
ncks $DEBUG -v $somevar $somefile $somevar.$somefile |
ncks $DEBUG -v $somevar $somefile $somevar.$somefile |
43 |
done |
done |
|
ncks $DEBUG -v iter $somefile iter.$somefile |
|
44 |
done |
done |