Monday, April 14, 2008
NetCDF build notes for Mac OS 10.5 with ifort and gfortran
I have recently written down the steps I needed to build netcdf3, hdf5, and netcdf4 on my Mac using both ifort and [gfortran](http://r.research.att.com/tools/). Details follow
Python build script for roms
I wrote a build script for ROMS in python based on some of the other build scripts (in bash and Cshell) I have seen. The usage is as follows:
Create a directory with a header file called case_name.h in it. This should have the CPP defs for your particular case. Then run the build script like this:
build-roms.py case_name
Options, as seen from the help are:
-h, --help Print this message
--fort=[ifort] Specify fortran compiler
--netcdf=[4, 3] Version of NetCDF to use [default is NetCDF4]
-j=n Parallel make [n = number of procs, default is 4]
--mpi Compile using mpi
--clean Delete Build scratch directory before build
--debug Compile in debug mode
--root Specify ROMS_ROOT_DIR
This script creates a Build directory in the local directory, where the actual compilation happens. Analytical things can be defined in an optional Functionals directory, just like with the other build scripts. To see the script, continue...
Create a directory with a header file called case_name.h in it. This should have the CPP defs for your particular case. Then run the build script like this:
build-roms.py case_name
Options, as seen from the help are:
-h, --help Print this message
--fort=[ifort] Specify fortran compiler
--netcdf=[4, 3] Version of NetCDF to use [default is NetCDF4]
-j=n Parallel make [n = number of procs, default is 4]
--mpi Compile using mpi
--clean Delete Build scratch directory before build
--debug Compile in debug mode
--root Specify ROMS_ROOT_DIR
This script creates a Build directory in the local directory, where the actual compilation happens. Analytical things can be defined in an optional Functionals directory, just like with the other build scripts. To see the script, continue...
Tuesday, January 29, 2008
using kd-trees for interpolation.
I have been looking for ways to interpolate big model results to other big mode results.. again. This seems to be an unsolved problem in ocean modeling. However, I have stumbled on a new method for finding nearest neighbors that seems quite promising.
As long as you are interpolating from something that has a relatively uniform grid with a relatively smooth field, you don't need to bring out the big guns, like optimal interpolation. In other words, you may often ignore data error in your interpolation - especially going from one model to another to generate initial or boundary conditions.
[Kd-trees](http://en.wikipedia.org/wiki/Kd-tree) (k-dimensional trees) are a method for organizing a set of k-dimensional points. In particular, I would like to find the nearest neighbors in three-dimensions. Many interpolation tools (such as [csa](http://www.marine.csiro.au/~sak007/) or [delaunay](http://scipy.org/scipy/scikits/browser/trunk/delaunay/) only work with 2D data.
The advantage of using kd-trees is twofold: First storing the tree is not very memory intensive, approximately the same size as the original point field itself, and building the tree scales roughly as the number of points (n log(n)). Second, searching for the closest points to a query point is quite fast (log(n)). The [ann library](http://www.cs.umd.edu/~mount/ANN/) can be used to return indicies of and distances to the M closest points to a query point. An example of how to use the ann library for interpolation is below the fold.
As long as you are interpolating from something that has a relatively uniform grid with a relatively smooth field, you don't need to bring out the big guns, like optimal interpolation. In other words, you may often ignore data error in your interpolation - especially going from one model to another to generate initial or boundary conditions.
[Kd-trees](http://en.wikipedia.org/wiki/Kd-tree) (k-dimensional trees) are a method for organizing a set of k-dimensional points. In particular, I would like to find the nearest neighbors in three-dimensions. Many interpolation tools (such as [csa](http://www.marine.csiro.au/~sak007/) or [delaunay](http://scipy.org/scipy/scikits/browser/trunk/delaunay/) only work with 2D data.
The advantage of using kd-trees is twofold: First storing the tree is not very memory intensive, approximately the same size as the original point field itself, and building the tree scales roughly as the number of points (n log(n)). Second, searching for the closest points to a query point is quite fast (log(n)). The [ann library](http://www.cs.umd.edu/~mount/ANN/) can be used to return indicies of and distances to the M closest points to a query point. An example of how to use the ann library for interpolation is below the fold.
ROMS project movie back online
The ROMS project movie (the only thing people seemed to miss during the black months when pong was down) is now back online. See it [here](http://pong.tamu.edu/~rob/movies/roms_project.mov).
Monday, January 14, 2008
Making images and animations of model output in google earth
I have been working on creating images and animations from google earth. I started out [here](http://www.barnabu.co.uk/animations/) for inspiration. Here are some samples of an [image](http://pong.tamu.edu/~rob/files/bsh.kmz) and an [animation](http://pong.tamu.edu/~rob/files/bsh_anim.kmz). The code is actually quite simple:
Sunday, January 13, 2008
Woot! Back up
Finally, after a massive hard drive failure, my web log is back up. To make a long story short, I promise to make better backups and buy Steve a beer.. I feel a pent up pile of posts -- so after waiting for so long, be sure to check often now.
Wednesday, November 14, 2007
Sample movie for GETM
Here is a sample script for generating a series of figures (that can be turned into a movie with ffmpeg, see [below](http://pong.tamu.edu/~rob/?p=100)). The case used is the box_curvilinear test case.
Subscribe to:
Posts (Atom)