Re: Regrid from CMG (climate modellig grid 0.05x0.05 deg) to EASE-grid

From: Ufuk Utku Turuncoglu (BE) <u.utku.turuncoglu_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 03 2012 - 07:14:00 MDT

Hi Ksenia,

You can use the following code as a start point,

   ;--- create SCRIP definition of source grid ---
   sfile = "src_atm.nc"
   if (.not. isfilepresent(sfile)) then
     opt = True
     opt@ForceOverwrite = True
     opt@PrintTimings = True
     opt@Title = "RegCM4 Mediterranean Grid"
     curvilinear_to_SCRIP(sfile, atm_lat2d, atm_lon2d, opt)
     delete(opt)
   end if

   ;--- create SCRIP definition of destination grid ---
   dfile = "dst_ocn.nc"
   if (.not. isfilepresent(dfile)) then
     opt = True
     opt@ForceOverwrite = True
     opt@PrintTimings = True
     opt@Title = "ROMS Mediterranean Sea Grid"
     curvilinear_to_SCRIP(dfile, ocn_lat2d, ocn_lon2d, opt)
     delete(opt)
   end if

   ;--- create weight matrix file ---
   wfile = "wgt_atm_to_ocn.nc"
   if (.not. isfilepresent(wfile)) then
     opt = True
     opt@ForceOverwrite = True
     opt@PrintTimings = True
     opt@SrcRegional = True
     opt@DstRegional = True
     opt@InterpMethod = "bilinear"
     ESMF_regrid_gen_weights(sfile, dfile, wfile, opt)
   end if

...

   var = ESMF_regrid_with_weights(atm_nc->t2m(:,0,:,:), wfile, opt)

In the first part, NCL create the grid definition file for RegCM model
(this is source grid). In this case coordinate arrays are 2d and you
have to use curvilinear_to_SCRIP. If it is 1d in your case, you can use
rectilinear_to_SCRIP function. It takes 1d coordinate arrays. In the
second block of code do the same think for ROMS ocean model (this is
destination grid). In this case, ROMS grid is also curvilinear and i
used curvilinear_to_SCRIP call. In the third block,
ESMF_regrid_gen_weights call generates weight matrix to perform sparse
matrix multiply later using ESMF_regrid_with_weights.
ESMF_regrid_with_weights basically interpolates 2 meter temperature to
ROMS grid. So, you can modify the code based on your requirements but
don't forget to download from the following link,

http://www.ncl.ucar.edu/Applications/Files/ESMF_regridding.ncl

I hope it helps,

Best Regards,

--ufuk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 3 07:14:12 2012

This archive was generated by hypermail 2.1.8 : Fri Aug 03 2012 - 14:39:58 MDT