Extracting temperature

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
ara952
Posts: 10
Joined: Thu May 23, 2019 9:39 pm
Location: University of New Brunswick

Extracting temperature

#1 Post by ara952 » Fri May 24, 2019 4:04 pm

Hi all.
I am totally new with ROMs.I need to extract temp for a specific location with lat and lon coordinate.I checked the nc file output,however the dimension for temp was XI×eta*s_rho_ocean_time.Would you please how I can extract the data?
Thank you

User avatar
kate
Posts: 3678
Joined: Wed Jul 02, 2003 5:29 pm
Location: IMS/UAF, USA

Re: Extracting temperature

#2 Post by kate » Fri May 24, 2019 4:17 pm

If you only have a few such location from which you want to extract fields, the easiest thing is to ask ROMS for a STATIONS file. You provide the lat,lon in the stations input file. If you don't have a chance to rerun the model, you will have to build tools for extracting from the ROMS output, using Matlab, Python, NCL, Ferret,...

ara952
Posts: 10
Joined: Thu May 23, 2019 9:39 pm
Location: University of New Brunswick

Re: Extracting temperature

#3 Post by ara952 » Fri May 24, 2019 5:24 pm

I have the nc file output of ROMs from NOAA Operational Model in the Gulf of Maine. I just need to extract 20 locations from the output. The problem is I have latitude and longitude positions and the temperature dimension in the nc file is different. How I can relate lat and lon to XI and eta?

User avatar
kate
Posts: 3678
Joined: Wed Jul 02, 2003 5:29 pm
Location: IMS/UAF, USA

Re: Extracting temperature

#4 Post by kate » Sat May 25, 2019 7:09 am

There should be a grid file somewhere with lat and lon as a function of xi and eta. The algorithm for finding the xi, eta (or i,j) of a given lat, lon is implemented inside ROMS in the routine hindices inside interpolate.F.

ara952
Posts: 10
Joined: Thu May 23, 2019 9:39 pm
Location: University of New Brunswick

Re: Extracting temperature

#5 Post by ara952 » Mon May 27, 2019 12:22 pm

I extracted the closest location to my desired latitude and longitude from the 'lon_rho' and 'lat_rho' with the dimension of (xi_rho,eta_rho),in my case the dimensions are as follow: lon_rho(119*119), lat_rho(119*119), and temp(119*119*30*24) and the closest longitude index is 3304 and the correspondent subscribe in lon_rho is (91*28). Could I use this subscribe(91*28) in the 'temp' parameter to extract my desired location temperature?

User avatar
kate
Posts: 3678
Joined: Wed Jul 02, 2003 5:29 pm
Location: IMS/UAF, USA

Re: Extracting temperature

#6 Post by kate » Tue May 28, 2019 3:56 pm

I think you are saying that the index is xi=91, eta=28. Yes, you can extract the temperature at that location to get a vertical column of numbers for each time.

ara952
Posts: 10
Joined: Thu May 23, 2019 9:39 pm
Location: University of New Brunswick

Re: Extracting temperature

#7 Post by ara952 » Tue May 28, 2019 4:06 pm

yes. This is the index. I will do that.
Does the grid file comes with the NC output?
Thank you

User avatar
kate
Posts: 3678
Joined: Wed Jul 02, 2003 5:29 pm
Location: IMS/UAF, USA

Re: Extracting temperature

#8 Post by kate » Tue May 28, 2019 4:10 pm

The ROMS default is to write out the grid file into every output netcdf file. I make many, many output netcdf files and have told ROMS not to put the grid into any of them. I know the grid because it is one of the ROMS input files. If you are using someone else's model output, you have to ask them for the grid if it isn't in all the output files.

ara952
Posts: 10
Joined: Thu May 23, 2019 9:39 pm
Location: University of New Brunswick

Re: Extracting temperature

#9 Post by ara952 » Tue May 28, 2019 4:16 pm

Thank you so much Kate, for your reply.

ara952
Posts: 10
Joined: Thu May 23, 2019 9:39 pm
Location: University of New Brunswick

Re: Extracting temperature

#10 Post by ara952 » Tue May 28, 2019 9:08 pm

Hi Kate.
I use this Matlab code to find the nearest node to my location. After using the i, j indices in the lat_rho and lon_rho, it gives me a location very far from my desired location. Could you help me with this?
Thank you.

yi =43.89818240;
xi =-66.31989730;

dist = sqrt( (lat_rho-yi)^2 +(lon_rho-xi)^2);
%dist = abs(lat_rho-yi) + abs(lon_rho-xi);
[i,j]= find(dist ==min(dist(:)));
lat_clos = lat_rho(i,j)
lon_clos = lon_rho(i,j)

Post Reply