# Re: recommended practices for moving from one curvilinear grid to another curvilinear grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 08 Jul 2009 16:44:59 -0600

[1]
Seth's approach will work but it could be made
more efficient at the expense of more memory.

If outlat(nlat,mlon), outlon(nlat,mlon)

lat1d = ndtooned( outlat )
lon1d = ndtooned( outlon )
ipol = rcm2points(lat2d,lon2d,data,lat1d,lon1d,1)
printVarSummary(ipol)

The above removes the explicit looping in NCL.
It will happen in the far more efficient compiled/optimized code.

If data is 2-dimensional
pol = onedtond( ndtooned( ipol ) , (/nlat,mlon/) )
delete(ipol)

If is 3D: data(ntim,:,:) or data(klev,:,:)
pol = onedtond( ndtooned( ipol ) , (/ntim,nlat,mlon/) )
or
pol = onedtond( ndtooned( ipol ) , (/klev,nlat,mlon/) )
delete (ipol)

If data(ntim,klev,:,:)
pol = onedtond( ndtooned( ipol ) , (/ntim,klev,nlat,mlon/) )
delete(ipol)
=============
[2]
'Not all numbers are created equal.'

The above will handle scalar quantities (eg, T, SLP, Q, ...).
However, interpolating vector quantities could be problematical.
Technically, (say) U and V must be interpolated *together* and
the rotation angle between the curilinear grids must be
taken into account.

==============
Good Luck
D

Seth McGinnis wrote:
> Hi Bill,
>
> I have written an NCL script to do exactly what you describe. I don't
> know that I'd go so far as to call it a "best practice", but the technique
> I found fairly speedy and not too ugly code-wise is to loop by hand
> over the cells of the target grid using rcm2points() to do the
> interpolation for each point separately. (The other approaches I looked
> at either took forever or gave me results I had a hard time being sure
> were structured correctly.) Here's the essence:
>
> do j = 0,ny-1
> do i = 0,nx-1
> ipol = rcm2points(lat2d,lon2d,data,outlat(j,i),outlon(j,i),1)
> outdata(:,j,i) = (/ipol/)
> end do
> end do
>
> Cheers,
>
> --Seth
>
> ----
> Seth McGinnis
> Associate Scientist
> NARCCAP Data Manager
> ISSE / NCAR
> ----
>
>
>
>> Message: 2
>> Date: Wed, 8 Jul 2009 14:11:18 -0600
>> From: "Capehart, William J" <William.Capehart_at_sdsmt.edu>
>> Subject: recommended practices for moving from one
>> curvilinear grid to another curvilinear grid
>> To: "ncl-talk_at_ucar.edu" <ncl-talk_at_ucar.edu>
>> Message-ID: <C67A5986.D657%wcapehar_at_sdsmt.edu>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>>
>> Hi All
>>
>> there are a number of functions in NCL to resample or interpolate between
>> one regular grid to another or from a curvilinear (e.g., RCM/WRF/NARR) into
>> rectilinear grids or vice versa but not much guidance on the "Regridding
>> Functions" page in the NCL documentation on how to go from one curvilinear
>> grid to another curvilinear gird. There a few multi-step approaches I can
>> see doing but I'd rather be able to do it in one "relatively painless" step
>> to avoid mangling the data more than needed. Are there any recommendations
>> on how to do that?
>>
>> Thanks Much
>> ================================================================
>> Bill Capehart <William.Capehart_at_sdsmt.edu> Associate Professor
>> Institute of Atmospheric Sciences Land Surface Processes
>> 213 Mineral Industries Building Hydrometeorology
>> South Dakota School of Mines and Technology Ph: +1-605-394-1994
>> 501 East Saint Joseph Street Fax: +1-605-394-6061
>> Rapid City, SD 57701-3995 Mobile: +1-605-484-5692
>> =================== http://capehart.sdsmt.edu ==================
>>
>>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

```--
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
```
Received on Wed Jul 08 2009 - 16:44:59 MDT

This archive was generated by hypermail 2.2.0 : Mon Jul 13 2009 - 20:56:19 MDT