[Thread Prev][Thread Next][Index]

Re: [ferret_users] Gridding i/j data on a lat/lon grid



On 05/06/2014 04:59 PM, vincent le fouest wrote:
Dear Users,

I have a variable gridded on a i/j grid. In a separate netcdf file, I have the latitudes and longitudes gridded on the same i/j grid as the variable. I am looking for a way of putting my variable on the lat/lon grid and not having it in the i/j grid anymore.

Thank you for any help you could provide me.

Kind regards,

Vincent
Hi Vincent,

This is quite straightforward.
1) Open your file where var is defined
2) Open file(s) where lon, lat are defined
3) Define axis from lon, lat variable
4) Define a grid using those axis
5) Assign var from step1 to the grid
6) Save you var in a new file

Some snippets of code:

use file_var.nc
use file_lon_lat.nc ! lon, lat are 2D arrays and describe a regular grid
def axis/units="degrees_east"/modulo xaxis=lon[j=1]
def axis/units="degrees_north" yaxis=lat[i=1]
def grid/x=xaxis/y=yaxis mygrid
let new_var=var[g=mygrid@ASN,d=1]
save/clobber/file=out.nc new var

Hope that will you
Patrick

--
LSCE/IPSL, Laboratoire CEA-CNRS-UVSQ
Data Analysis and Visualization Engineer
ICMC - IPSL Climate Modelling Centre
--



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement