Re: [netcdfgroup] Creating a NetCDF file for VisIt with an unstructured grid

  • To: Tim Duly <duly2@xxxxxxxxxxxx>
  • Subject: Re: [netcdfgroup] Creating a NetCDF file for VisIt with an unstructured grid
  • From: Rich Signell <rsignell@xxxxxxxx>
  • Date: Tue, 27 Mar 2012 10:20:59 -0400
Tim,

You mention quite a few things here: unstructured grids, Matlab,
NetCDF, CF, Python and Visit.

If your goal is to truly to visualize unstructured grid data from
NetCDF files (or OPeNDAP datasets) using Python, take a look at this
screen shot using Mayavi2

http://dl.dropbox.com/u/12710282/Screenshot-Mayavi.png

and the simple code that produced it:

http://dl.dropbox.com/u/12710282/triangular_mesh_demo.py

Mayavi2 comes with at least two scientific Python distributions:
Python(x,y) (free, works on 32 bit windows) and the Enthought Python
Distribution (free for educational use, works on 32/64 bit windows,
mac and linux).  You should be able to run the above python script
without changes on either distribution.

However, it sounds like you actually have structured grid data in a
text file that you want to use.   In python, I would use numpy
"genfromtxt" to read from the text file, and visualize with Mayavi2's
"surf" function.  See:
http://github.enthought.com/mayavi/mayavi/auto/examples.html

If you want to save your data in a NetCDF file, I'd use the
NetCDF4Python package (also included in the above scientific python
distributions).   This would allow you to visualize it in other tools
as well, like Unidata's IDV.

Good Luck,
-Rich

On Mon, Mar 26, 2012 at 3:31 PM, Tim Duly <duly2@xxxxxxxxxxxx> wrote:
> Hello,
>
> I have a relatively simple task. I have 2D data, of dimension 200x100 that
> belong to an unstructured grid that contains X and Y, both of which are
> dimension 200x100.  In other words, I have DATA = f(X,Y).
>
> I'm trying to plot this in VisIt, but am having a tough time applying the
> unstructured grid to the actually data.  In MATLAB, for example, this is
> easily accomplished with surf(X,Y,DATA), but I'm having difficulties finding
> the equivalent in NetCDF.  How do I do this?  Is this problem solved in
> NetCDF or in VisIt?
>
> I am using the Python library NetCDF to transform unformatted Fortran data
> into NetCDF format.  I have read this page
> ( http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.4/cf-conventions.html#id2984605 ;)
> but I do not understand how to do this with the NetCDF library in python.
>  Should I use another data format besides NetCDF?
>
> Any help would be greatly appreciated.
>
> Thanks,
> Tim
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit:
> http://www.unidata.ucar.edu/mailing_lists/



-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598



  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: