Re: (no subject)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 09 2013 - 16:29:55 MDT

Hi Laura,

The ESMF_regrid_gen_weights function assumes that you've already generated the intermediate SCRIP/ESMF files required by the ESMF regridding tool. From your script below, it's not clear to me that you did this step.

These files are *not* the same ones as your original NetCDF files. Rather, they are special files that have to be in a specific format in order for the weights file to be created.

You either need to use the "all-in-one" function ESMF_regrid, which creates the intermediate files, creates the weights file, and does the regridding, OR you need to call unstructured_to_ESMF for both your source and destination grids, before you call ESMF_regrid_gen_weights.

Please see example ESMF_all_10.ncl at:

http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex10

In particular, look at the "unstructured_to_ESMF" call, which is what you need.
Since you have both a source and destination grid that is unstructured, you
will need to call this procedure twice (unlike this example, which uses unstructured_to_ESMF
and latlon_to_SCRIP).

--Mary

On Oct 9, 2013, at 2:42 PM, Laura Fowler <laura@ucar.edu> wrote:

> Hi:
> I am trying to write a template to regrid an unstructured MPAS grid to
> an other higher or lower resolution unstructured MPAS grid using ESMF.
> I am using the function ESMF_regrid_gen_weights so that I can reuse
> the file containing the weights. See the ncl script below.
>
> 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
>
> r2d = 180.0d/(atan(1)*4.0d) ; conversion from radians to degrees.
>
> src_file = "x1.40962.grid.nc"
> sfile = addfile(src_file,"r")
>
> src_file2 = "x1.10242.grid.nc"
> sfile2 = addfile(src_file2,"r")
>
> opt = True
> opt@Debug = True
> opt@InterpMethod = "bilinear"
> opt@ForceOverwrite = True
> opt@SrcESMF = True
> opt@DstESMF = True
>
> opt@SrcGridLon = sfile2->lonCell*r2d ; source grid lon input.
> opt@SrcGridLat = sfile2->latCell*r2d ; source grid lat input.
> opt@DstGridLon = sfile->lonCell*r2d ; destination grid lon grid.
> opt@DstGridLat = sfile->latCell*r2d ; destination grid lat grid.
>
> srcGridName = src_file2
> dstGridName = "x1.10242_to_40962.nc"
> wgtGridName = "weights.10242_to_40962.nc"
> ESMF_regrid_gen_weights(srcGridName,dstGridName,wgtGridName,opt)
>
> end
>
> I get the following error message:
> (0) x1.10242.grid.nc
> (0) ESMF_regrid_gen_weights: number of processors used: 1
> (0) --------------------------------------------------
> (0) ESMF_regrid_gen_weights: the following command is about to be
> executed on the system:
> (0) 'ESMF_RegridWeightGen --source x1.10242.grid.nc --destination
> x1.10242_to_40962.nc --weight weights.10242_to_40962.nc --method
> bilinear --src_type ESMF --dst_type ESMF -i --64bit_offset'
> (0) --------------------------------------------------
> ESMF_LogWrite(): Deprecated: Use logmsgFlag instead of logmsgList.
> (0) ESMF_regrid_gen_weights: output from 'ESMF_RegridWeightGen':
> (0) Starting weight generation with these inputs:
> (1) Source File: x1.10242.grid.nc
> (2) Destination File: x1.10242_to_40962.nc
> (3) Weight File: weights.10242_to_40962.nc
> (4) Source File is in ESMF format
> (5) Source Grid is a global grid
> (6) Source Grid is an unstructured grid
> (7) Destination File is in ESMF format
> (8) Destination Grid is a global grid
> (9) Destination Grid is an unstructured grid
> (10) Regrid Method: bilinear
> (11) Pole option: ALL
> (12) Ignore unmapped destination points
> (13) Output weight file in 64bit offset NetCDF file format
> (14)
> (15) NetCDF Error: Dimension nodeCount in x1.10242.grid.nc :
> NetCDF: Invalid dimension ID or name
> (16) ERROR: Problem on processor 0 . Please see the
> PET*.RegridWeightGen.Log files for a traceback.
> (0) --------------------------------------------------
> (0) ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not
> successful.
>
> and my PET file looks like
>
> 20131009 143041.025 INFO PET0 Running with ESMF Version 5.2.0rp2
> 20131009 143041.120 ERROR PET0 ESMF_IOScrip.F90:1963
> ESMF_GetMeshFromFile netCDF Status Return Error
> 20131009 143041.120 ERROR PET0 ESMF_Mesh.F90:1192
> ESMF_MeshCreateFromUnstruct() Failure - Internal subroutine call
> returned Error
> 20131009 143041.120 ERROR PET0 ESMF_Mesh.F90:1075
> ESMF_MeshCreateFromFile() Failure - Internal subroutine call returned
> Error
> 20131009 144050.758 INFO PET0 Running with ESMF Version 5.2.0rp2
> 20131009 144050.763 ERROR PET0 ESMF_IOScrip.F90:1963
> ESMF_GetMeshFromFile netCDF Status Return Error
> 20131009 144050.763 ERROR PET0 ESMF_Mesh.F90:1192
> ESMF_MeshCreateFromUnstruct() Failure - Internal subroutine call
> returned Error
> 20131009 144050.763 ERROR PET0 ESMF_Mesh.F90:1075
> ESMF_MeshCreateFromFile() Failure - Internal subroutine call returned
> Error
>
> I did not find any information in the ESMF documentation regarding
> that error message. I would really like a hint on what to do next.
>
> Thanks,
> Laura
>
> !----------------------------------------------------
> Laura D. Fowler
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura@ucar.edu
> phone : 303-497-1628
>
> !----------------------------------------------------
> _______________________________________________
> 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 Oct 9 16:30:04 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 22 2013 - 10:35:27 MDT