Re: About the new ESMF regridding !

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 02 2012 - 09:40:51 MDT

Dear Echo,

Welcome to the NCL community.

In the ESMF_all_7.ncl script, the "test_CNRM.nc" file actually only has one time step, so that's partially why it's only reading the one time step.

However, if this file had multiple time steps, then you can easily change to multiple time steps by changing this line:

    tos = sfile->tos(0,:,:)

to:

    tos = sfile->tos

Assuming the mask is the same for each timestep, then you also need to change this line:

      Opt@Mask2D = where(.not.ismissing(tos),1,0)

to:

      Opt@Mask2D = where(.not.ismissing(tos(0,:,:)),1,0)

When you get to this call:

    tos_regrid = ESMF_regrid_with_weights(tos,wgtFile,Opt)

It should automatically regrid across however many dimensions you have. "tos_regrid" will have the same leftmost dimensions as "tos", and the rightmost dimensions will be whatever grid you regridded it to.

The important thing to note is that this method will only work if your grids are the same across all leftmost dimensions. If you have a source or destination grid that changes with each time or level or any other leftmost dimension, then you need to generate a separate weights file for each of these.

If you look at example ESMF_all_6.ncl, which regrids data from a CMIP5 grid to a 1x1 grid, the same rules apply. This file has multiple timesteps and levels, so you would simply change two lines:

     thetao = sfile->thetao(0,0,:,:)

to:

     thetao = sfile->thetao

and:

       Opt@Mask2D = where(.not.ismissing(thetao),1,0)

to:

       Opt@Mask2D = where(.not.ismissing(thetao(0,0,:,:)),1,0)

In this case, then, since "thetao" is dimensioned 600 x 19 x 220 x 256 (time x lev x lat x lon), then "thetao_regrid" will be dimensioned 600 x 19 x 180 x 360, since 180 x 360 is the size of the destination (1x1) grid.

Hope this helps clear things up.

--Mary

On Nov 1, 2012, at 8:03 PM, ³ÂÏþ³¿ wrote:

> Dear ncl communit,
>
>
> I am a new leaner. It's first time for me to send a email to the community. English is not my mother tougue, so maybe there are some mistakes in my email. Thank you for your understanding.
>
> I run the new ESMF regridding script- ESMF_all_7.ncl , and I succeed in plotting after I modify some instrctions.( http://www.ncl.ucar.edu/Applications/ESMF.shtml) I also scan other scripts in the ESMF regridding example pages for reference. But I want to regrid a 3D or 4D (or higher) data like A(:,:,:) and output it ,but all scripts just regrid a 2D data like A(0,:,:) or A(0,0,:,:).
>
> I have a large number of datum to regrid. My datum on rectilinear are from CMIP. The type of interpolation methods is bilinear.Do you have some suggestions for me? Maybe I should use cycling but I do not know how.
>
> Thanks for your attention!
>
>
>
> Echo
> _______________________________________________
> 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 Fri Nov 2 09:41:02 2012

This archive was generated by hypermail 2.1.8 : Tue Nov 06 2012 - 15:05:49 MST