best 3D visualization tool for ROMS

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
sonaljit.m
Posts: 43
Joined: Wed Nov 30, 2016 11:18 pm
Location: University of Massachusetts Dartmouth

best 3D visualization tool for ROMS

#1 Unread post by sonaljit.m »

Hi. I need to use a 3D visualization software for ROMS outputs. Most visualization tools use a Cartesian coordinate system. But since the ROMS outputs are in terrain following sigma coordinates, I have to interpolate the sigma grid to a Cartesian grid, which is time consuming. Is there a good visualization tool available for ROMS, which can directly visualize the output fields in 3D?

Thanks.

MIDHILAVARNAV
Posts: 30
Joined: Fri Dec 15, 2017 6:07 pm

Re: best 3D visualization tool for ROMS

#2 Unread post by MIDHILAVARNAV »

ROMS tools (Matlab based) have a romsgui function, an interactive visual toolbox. ( The link http://forge.ipsl.jussieu.fr/roms_locea ... order=name). Pl Check folder visualisation tools

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: best 3D visualization tool for ROMS

#3 Unread post by wilkin »

I have written code (roms_isosurface.m) to use Matlab's isosurface function to create 3D visualizations. This is part of my roms_wilkin toolbox at https://github.com/johnwilkin/roms_wilkin

Some examples are shown below generated by roms_isosurface_demo.m in the GitHub repo.The demo calls an OPeNDAP URL for ROMS output, so anyone can reproduce these plots by running the demo.

As you noted, Matlab isosurface works in uniform spacing Cartesian space, but ROMS native i,j,k is such a space. The magic in roms_isosurface.m is to create griddedInterpolant classes that convert i,j,k space to ROMS lon,lat,z space. The isosurface is rendered in i,j.k space but then the isosurface vertices are converted to lon,lat,z before the surf function is called to display.

Creating the griddedInterpolant classes is very straightforward:

Code: Select all

% Isosurface works in plaid i,j,k space, so the surface will be rendered 
% in i,j,k coordinates that will then be mapped to lon,lat,z for display.
% This is by far preferable to regridding the data to a uniform lon/lat
% grid.

% set up the i,j,k, to lon,lat,z transformation
[I3,J3,K3] = ndgrid(1:size(data,1),1:size(data,2),1:size(data,3));
[I2,J2] = ndgrid(1:size(data,1),1:size(data,2));

Fx = griddedInterpolant(I2,J2,permute(g.lon_rho,[2 1]));
Fy = griddedInterpolant(I2,J2,permute(g.lat_rho,[2 1]));
Fz = griddedInterpolant(I3,J3,K3,permute(g.z_r,[3 2 1]));

% get the isosurface in i,j,k space
S = isosurface(I3,J3,K3,data,value);
Snew = S;

% convert fractional i,j to lon/lat and fractional k to z by interpolation
Snew.vertices(:,1) = Fx(S.vertices(:,1),S.vertices(:,2));
Snew.vertices(:,2) = Fy(S.vertices(:,1),S.vertices(:,2));
Snew.vertices(:,3) = Fz(S.vertices(:,1),S.vertices(:,2),S.vertices(:,3));
doppio_velocity_isosurface.png
doppio_salinity_front_isosurface.png
doppio_cold_pool_isosurface.png
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Post Reply