Re: Regridding using conserve method

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 01 2013 - 09:12:12 MDT

On Sep 25, 2013, at 12:48 PM, Rike Völpel <Rike_V@gmx.de> wrote:

> Dear NCL-Talk,
>
> I´m running the newest version of NCL, trying to regrid river runoff from a POP gx3v5 to the cubed sphere grid of the MITgcm. I would like to use the conserve method, thus providing both lat/lon grid center and lat/lon grid corners for the source and destination grid. The description for the source lat/lon grid center and lat/lon grid corners is stored under a different file (remap_grid_POPgx3p_level01.nc) than the variable (run031_pop.ocn.541-640.multyravg.nc) I´m going to regrid. Can this cause a problem?

Dear Rike,

This shouldn't be a problem at all, but your corner lat/lon values must be nlat x nlon x 4, where nlat x nlon is the size of the lat/lon arrays that represent the grid centers. The error message seems to be coming from the fact that you are telling ESMF_regrid that you have a curvilinear grid, but then you are giving it 1D lat/lon arrays. Curvilinear grids are 2D.

I think your error is with these two lines:

> Opt@SrcGridLat = sfile->grid_center_lat
> Opt@SrcGridLon = sfile->grid_center_lon

These two parameters are supposed to represent your grid centers, but I thought your grid centers were these two arrays:

> src_lat = vfile->TLAT
> src_lon = vfile->TLONG

so the two lines should probably be :

> Opt@SrcGridLat = src_lat
> Opt@SrcGridLon = src_lon

However, I'm a bit suspicious of the fact that you seem to have three sets of lat/lon arrays for your source grid. Please make sure your arrays are the correct sizes:

printVarSummary(sfile->grid_corner_lat)
printVarSummary(sfile->grid_corner_lon)
printVarsummary(src_lat)
printVarsummary(src_lon)

You may want to do this as well, just to see what these arrays are like:

printVarSummary(sfile->grid_center_lat)
printVarSummary(sfile->grid_center_lon)

--Mary

> When running the script I get the following error message:
>
> (0) write_grid_description: source lat dims = (11600)
> (0) write_grid_description: source lon dims = (11600)
> (0) write_grid_description: source grid type is 'curvilinear'
> fatal:Number of dimensions in parameter (1) of (curvilinear_to_SCRIP) is (1), (2) dimensions were expected
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 3011 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 3122 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 83 in file curv_2_unstr.ncl
>
> The script I´m using looks like this so far:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
> begin
> ;---Data file containing source grid
> src_file = "remap_grid_POPgx3p_level01.nc"
> sfile = addfile(src_file,"r")
> ;---Get variable to regrid
> var_file = "run031_pop.ocn.541-640.multyravg.nc"
> vfile = addfile(var_file,"r")
> var = vfile->ROFF_F
> src_lat = vfile->TLAT
> src_lon = vfile->TLONG
>
> ;---Data file containing destination grid
> dst_file = "cs32_grid.nc"
> dfile = addfile(dst_file,"r")
> dst_lat = dfile->grid_center_lat
> dst_lon = dfile->grid_center_lon
> ;---Set up regridding options
> Opt = True
> Opt@InterpMethod = "conserve"
> Opt@WgtFileName = "curv_to_unstruct.nc"
> Opt@SrcGridType = "curvilinear"
> Opt@SrcGridLat = sfile->grid_center_lat
> Opt@SrcGridLon = sfile->grid_center_lon
> Opt@SrcGridCornerLat = sfile->grid_corner_lat
> Opt@SrcGridCornerLon = sfile->grid_corner_lon
> Opt@SrcRegional = False ;;--Change (maybe)
> Opt@SrcMask2D = where(.not.ismissing(var),1,0)
>
> Opt@DstGridType = "unstructured"
> Opt@DstGridLat = dst_lat
> Opt@DstGridLon = dst_lon
> Opt@DstGridCornerLat = dfile->grid_corner_lat
> Opt@DstGridCornerLon = dfile->grid_corner_lon
> Opt@DstRegional = False ;;--Change (maybe)
> Opt@DstMask2D = where(.not.ismissing(dst_lat).and.\
> .not.ismissing(dst_lon),1,0)
>
> Opt@ForceOverwrite = True
> Opt@PrintTimings = True
> Opt@Debug = True
>
> runoff_regrid = ESMF_regrid(var,Opt)
> printVarSummary(var_regrid)
> end
>
> So I think ESMF_regrid has trouble with my array sizes? Or do I get anything else wrong? I would really appreciate your help!
> Thanks in advance!
> Rike
> _______________________________________________
> 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 Oct 1 09:12:25 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT