Re: bug(?) in rectilinear_to_SCRIP and related functions

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 06 2012 - 08:57:52 MDT

Hi Bill,

I will have to take a look at this closer. FYI, the cell corners are only used in the case of the "conserve" remapping, and not for "bilinear" or "patch".

The cell corners that we calculate are just a best guess. We highly recomend that if users want to use the "conserve" method, *and* if they have a complicated grid, they really should be providing their own cell corners.

I'll take a look at the script below. Thanks for providing a small example.

--Mary

On May 31, 2012, at 12:41 PM, Bill Sacks wrote:

> Hi,
>
> First: I am very happy to see the new ncl functions related to creating SCRIP grids -- thanks for this!
>
> However: It looks like there is a bug in rectilinear_to_SCRIP and related functions, specifically in the determination of the corners in all of the cells on the edge of the domain. All of these edge cells have their outer edges exactly at the center of the cell – that is, the edge cells are just half the width that they should be.
>
> The following script illustrates the problem:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
>
> begin
> lat = (/39.,40.,41./)
> lon = (/89.,90.,91./)
> Opt = True
> Opt@LLCorner = (/38.5,88.5/)
> Opt@URCorner = (/41.5,91.5/)
> Opt@ForceOverwrite = True
> Opt@Debug = True
> rectilinear_to_SCRIP("test.nc", lat, lon, Opt)
> end
>
>
>
> This gives the following screen output:
>
> (0) curvilinear_to_SCRIP: calculating grid corners...
> (0) calc_SCRIP_corners
> (0) min/max original lat: 39/41
> (0) min/max original lon: 89/91
> (0) calc_SCRIP_corners
> (0) min/max grid_corner_lat2d: 39/41
> (0) min/max grid_corner_lon2d: 89/91
> (0) calc_SCRIP_corners
> (0) min/max grid_corner_lat: 39/41
> (0) min/max grid_corner_lon: 89/91
>
>
> An ncdump of the resulting file gives:
>
> data:
>
> grid_dims = 3, 3 ;
>
> grid_center_lat = 39, 39, 39, 40, 40, 40, 41, 41, 41 ;
>
> grid_center_lon = 89, 90, 91, 89, 90, 91, 89, 90, 91 ;
>
> grid_imask = 1, 1, 1, 1, 1, 1, 1, 1, 1 ;
>
> grid_corner_lat =
> 39, 39, 39.5, 39.5,
> 39, 39, 39.5, 39.5,
> 39, 39, 39.5, 39.5,
> 39.5, 39.5, 40.5, 40.5,
> 39.5, 39.5, 40.5, 40.5,
> 39.5, 39.5, 40.5, 40.5,
> 40.5, 40.5, 41, 41,
> 40.5, 40.5, 41, 41,
> 40.5, 40.5, 41, 41 ;
>
> grid_corner_lon =
> 89, 89.5, 89.5, 89,
> 89.5, 90.5, 90.5, 89.5,
> 90.5, 91, 91, 90.5,
> 89, 89.5, 89.5, 89,
> 89.5, 90.5, 90.5, 89.5,
> 90.5, 91, 91, 90.5,
> 89, 89.5, 89.5, 89,
> 89.5, 90.5, 90.5, 89.5,
> 90.5, 91, 91, 90.5 ;
> }
>
> As you can see, both the screen output and the ncdump indicate that the corners of the edge cells are the same as the cell centers.
>
> It looks like this problem arises in calc_SCRIP_corners, in the code for the edge and corner cells.
>
> Also, a related problem is that, as far as I can tell, the LLCorner and URCorner attributes aren't used by most of these *_to_SCRIP routines (though I may be missing something in that respect).
>
> I would propose a solution like: determine the southern corner latitudes of a cell on the southern edge of the domain as: (center_lat – (northern_corner_lat – center_lat)).
>
> Thank you,
> Bill
> _______________________________________________
> 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 Wed Jun 6 08:58:05 2012

This archive was generated by hypermail 2.1.8 : Tue Jun 12 2012 - 13:58:38 MDT