HI
I want to convert the ROMS output on Spherical grid to a regular lat-lon grid. Is there any utility available for this.
Thanks
Regards
Ratnam
ROMS output on regular lat/lon
-
- Posts: 9
- Joined: Fri Oct 22, 2004 8:32 pm
- Location: Numerics Warehouse Ltd.
Hi Ratnam,
We use PMEL's Ferret (http://ferret.wrc.noaa.gov/Ferret/) to do this. It is very fast, free and can be installed on desktops or 64 bits servers. The regridding to a regular lat lon grid is done in two stages :- firstly you need to make a mapping function, which can take a lot of processing power (use a server?). This is a one off operation :-
set memory/size=150 ! give ferret lots of memory to work with
use ne_atl_his_0434.nc ! pull in the NetCDF history data
define axis/x=-40:10:0.1/modulo/units=degrees xax ! specify new grid
define axis/y=40:70:0.05/modulo/units=degrees yax
let lonlatout = y[gy=yax] + x[gx=xax] ! define your new lat lon grid
let lonin = lon_rho[d=1]
let latin = lat_rho[d=1]
let map = curv_to_rect_map ( lonin,latin,lonlatout,0.5) ! regrid
save/clobber/file=ne_atl_curv_map_rho_hires.nc map ! save to an nc file
Now you can use the mapping function on your data :-
use ne_atl_his_0434.nc ! pull in the NetCDF history data
use ne_atl_curv_map_rho.nc
let out_salt = curv_to_rect(salt[d=1,K=1,L=1], map[d=2])
shade out_salt ! plot it to look at it
save/clobber/file=salt_regrid.nc out_salt
You can add extra 2D or 3D variables using the 'append' option to save (removing 'clobber' of course)
By the way if you want to regrid from sigma to z levels, you do this before the lat lon regridding :-
In Matlab use the zlevs.m function to generate a 3D grid of depths of each s level and then save this to a netCDF file called z_rho.nc. Then in Ferret, do something like this :-
set memory/size=150
use ne_atl_his_0434.nc ! d=1
use z_rho.nc ! d=2
def axis/z=-4500:0:100/depth/units=m z100 ! new z axis
let znew = z[gz=z100]
let zz=z_rho[d=2]*-1000 ! not sure why I do this!
let salt_depth=zaxreplace(salt[d=1],zz,znew) ! regrid the data
save/clobber/file=salt_z_regrid.nc salt_depth[k=10:40] ! save to new nc file
Ferret is not particularly intuitive, but it does the job and this kind of regridding is useful to generate model output which is compliant with OGC standards WMS/WCS/WFS.
Good luck,
Marcel
We use PMEL's Ferret (http://ferret.wrc.noaa.gov/Ferret/) to do this. It is very fast, free and can be installed on desktops or 64 bits servers. The regridding to a regular lat lon grid is done in two stages :- firstly you need to make a mapping function, which can take a lot of processing power (use a server?). This is a one off operation :-
set memory/size=150 ! give ferret lots of memory to work with
use ne_atl_his_0434.nc ! pull in the NetCDF history data
define axis/x=-40:10:0.1/modulo/units=degrees xax ! specify new grid
define axis/y=40:70:0.05/modulo/units=degrees yax
let lonlatout = y[gy=yax] + x[gx=xax] ! define your new lat lon grid
let lonin = lon_rho[d=1]
let latin = lat_rho[d=1]
let map = curv_to_rect_map ( lonin,latin,lonlatout,0.5) ! regrid
save/clobber/file=ne_atl_curv_map_rho_hires.nc map ! save to an nc file
Now you can use the mapping function on your data :-
use ne_atl_his_0434.nc ! pull in the NetCDF history data
use ne_atl_curv_map_rho.nc
let out_salt = curv_to_rect(salt[d=1,K=1,L=1], map[d=2])
shade out_salt ! plot it to look at it
save/clobber/file=salt_regrid.nc out_salt
You can add extra 2D or 3D variables using the 'append' option to save (removing 'clobber' of course)
By the way if you want to regrid from sigma to z levels, you do this before the lat lon regridding :-
In Matlab use the zlevs.m function to generate a 3D grid of depths of each s level and then save this to a netCDF file called z_rho.nc. Then in Ferret, do something like this :-
set memory/size=150
use ne_atl_his_0434.nc ! d=1
use z_rho.nc ! d=2
def axis/z=-4500:0:100/depth/units=m z100 ! new z axis
let znew = z[gz=z100]
let zz=z_rho[d=2]*-1000 ! not sure why I do this!
let salt_depth=zaxreplace(salt[d=1],zz,znew) ! regrid the data
save/clobber/file=salt_z_regrid.nc salt_depth[k=10:40] ! save to new nc file
Ferret is not particularly intuitive, but it does the job and this kind of regridding is useful to generate model output which is compliant with OGC standards WMS/WCS/WFS.
Good luck,
Marcel
Re: ROMS output on regular lat/lon
may i know what is 0.5 in (let map = curv_to_rect_map ( lonin,latin,lonlatout,0.5) )