Re: curvilinear regridding

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 19 2012 - 09:02:06 MDT

Hi Matt,

In Version 6.1.0-beta of NCL, we have some new ESMF regridding routines that allow you to go from rectilinear, curvilinear, or unstructured grids, to any one of these three grids.
You should be able to use this software to go from a curvilinear grid to a curvilinear grid.

Here's a code snippet of what the regridding might look like. I'm assuming that the file that contains the "source" WRF grid is called "wrf_output.nc", and that the curvilinear lat/lon grid on the file is called "XLAT" and "XLONG". I'm also assuming XLAT and XLONG are 3D, so I'm just grabbing the first time step of both.

Finally, I'm assuming that the "destination" MM5 grid is on a file called "mm5_grid.nc" and that the curvilinear lat/lon variables are simply called "lat" and "lon":

;---Read the source and destination lat/lon grids
    srcFileName = "wrf_output.nc"
    dstFileName = "mm5_grid.nc"

    sfile = addfile(srcFileName,"r")
    dfile = addfile(dstFileName,"r")

    src_lat = sfile->XLAT(0,:,:)
    src_lon = sfile->XLON(0,:,:)
    dst_lat = dfile->lat
    dst_lon = dfile->lon

;---Read the data you want to regrid
    x = sfile->x

;---Options for regridding
    Opt = True

;---source grid information
    Opt@SrcRegional = True
    Opt@SrcGridLat = src_lat
    Opt@SrcGridLon = src_lon

;---destination grid information
    Opt@DstRegional = True
    Opt@DstGridLat = dst_lat
    Opt@DstGridLon = dst_lon
;
; If you run the script multiple times, then the three
; NetCDF files that get written (source description
; file, destination description file, and weights file)
; will be overwritten without any prompting.
;
    Opt@ForceOverwrite = True

    Opt@CopyVarCoords = True ; Whether to copy coordinate information
                                 ; to regridded variable

    Opt@InterpMethod = "bilinear" ; (default) "patch" or "conserve"

    xregrid = ESMF_regrid(x,Opt) ; Regrid "x" to new grid

If you are able to provide me with a sample of both grids, I would be happy to add an example to our ESMF regridding page:

http://www.ncl.ucar.edu/Applications/ESMF.shtml

Cheers,

--Mary

On Jun 19, 2012, at 8:44 AM, Matthew Fearon wrote:

> Dear NCL users:
>
> I'm working with both older MM5 output and more recent WRF for an overlapping spatial domain. I would like to aggregate / regrid WRF output to the MM5 grid, 2km to 4km, respectively. Is there a pre-written tool in NCL to do this? I see there's options for going from curvilinear to rectilinear and vice versa, but not curvilinear to curvilinear?
>
> Suggestions would be very helpful, thanks,
> Matt
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 19 09:02:13 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT