Skip to content
Dmitry Shcherbin edited this page Jan 14, 2015 · 2 revisions

Files:

Snapshots

The python script which extracts all the snapshots of desired variable:

Usage:

You can get info on how to use it this way:

./pymframesperfile.py -h
usage: pymframesperfile.py [-h] [-o DIR] [-i INPUT] [-v VARIABLE]
                           [--time TIME] [--vert VERT] [--xzoom XZOOM]
                           [--yzoom YZOOM] [--var_min VAR_MIN]
                           [--var_max VAR_MAX] [--title TITLE]
 
frames generator, extracts snapshots from netcdf file
 
optional arguments:
  -h, --help         show this help message and exit
  -o DIR             output dir
  -i INPUT           input file
  -v VARIABLE        variable
  --time TIME        time counter
  --vert VERT        vertical coordinate number
  --xzoom XZOOM      zoom along x(?) direction, range is defined in percents
  --yzoom YZOOM      zoom along y(?) direction, range is defined in percents
  --var_min VAR_MIN  minimum value of variable
  --var_max VAR_MAX  minimum value of variable
  --title TITLE      insert title

Usage example:

             ./pymframesperfile.py -i ocean_avg_0620_2010_07_07.nc -o frame -v hice --title 'test title'

Output directory - named 'frame' (if it doesn’t exist – it will be created).

The shell script, which iterates through the specified files:

Usage:

nohup ./shframes_ice.sh 607 621 &

It iterates from ocean_avg_0607_2010_02_27.nc to ocean_avg_0621_2010_07_17.nc and applies the following command line to files:

if foo="$(python pymframesperfile.py -o hice -v hice --var_min 0.0 --var_max 6.0 -i $file --title='jens ice.in')"; then

You need to customize it to adapt it to your needs.

How to create an avi file from snapshots

After creating a bunch of png pictures in a specified folder, I usually convert all pngs into jpgs:

mogrify -format jpg -resize 80% *.png &

To create a movie from jpg frames you can use whatever you want, on my laptop (in linux I run in the virtualbox) I use mencoder:

mencoder mf://*.jpg -mf w=1600:h=600:fps=5:type=jpg -oac copy -audiofile eno.mp3 -ovc copy -oac copy -o hice_2005_2010.avi

(NB: there is no mencoder on stallo)

Sample output: