How to extract all sea surface height data along the lon, lat path

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
zhaolv
Posts: 39
Joined: Thu Nov 11, 2021 3:56 pm
Location: Changsha University of Science and Technology

How to extract all sea surface height data along the lon, lat path

#1 Unread post by zhaolv »

I have recently been using the "roms_wilkin-master" toolkit. I would like to know how I should extract all the sea surface height data along the lon, lat paths.
So far I have found that the roms_genslice function can extract 4-D data along the path, but how should I get the zeta data?

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

Re: How to extract all sea surface height data along the lon, lat path

#2 Unread post by MIDHILAVARNAV »

I think you could use the roms_2d slice.m function in the same repository or use secondary software like Ferret (sample_xyt) to extract the data from the post-processed ROMS output data.

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

Re: How to extract all sea surface height data along the lon, lat path

#3 Unread post by wilkin »

Just code it yourself using the scatteredInterpolant class:

Code: Select all

% some ROMS output
f = 'http://tds.marine.rutgers.edu/thredds/dodsC/roms/doppio/2017_da/his/History_Best';

% get some zeta output
t0 = 1000;
tcount = 100;
zeta = ncread(f,'zeta',[1 1 t0],[Inf Inf tcount]);

% get the lon/lat coordinates
lon = ncread(f,'lon_rho');
lat = ncread(f,'lat_rho');

% construct a scatteredInterpolant class - do this only once because
% lon_rho,lat_rho don't change on subsequent uses of F
tindex = 1;
data = squeeze(zeta(:,:,tindex));
F = scatteredInterpolant(lon(:),lat(:),data(:));

% define the lon,lat path you want to "slice"
N = 100;
lontrk = linspace(-72.5,-70.5,N);
lattrk = linspace(40.0,36.5,N);

% Demo: step through the subset of zeta you downloaded and plot along
% the lon,lat path

for tindex = 1:tcount
  
  % no need to recompute the scatteredInterpolant for every zeta, just
  % update the Values
  data = squeeze(zeta(:,:,tindex));
  F.Values = data(:);
  
  % evalute along lontrk,lattrk
  dattrk = F(lontrk,lattrk);
  
  % plot 
  plot(lontrk,dattrk)
  ylim([-1 1])
  drawnow
end
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

zhaolv
Posts: 39
Joined: Thu Nov 11, 2021 3:56 pm
Location: Changsha University of Science and Technology

Re: How to extract all sea surface height data along the lon, lat path

#4 Unread post by zhaolv »

Thank you very much for your guidance, it has helped me a lot

Post Reply