Re: ESMF regridding issue

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 07 2013 - 08:46:44 MST

Hi Kevin,

My mistake, I should have told you "rectilinear" and not "unstructured". Can you try that
and let me know?

If you continue to have problems, would it be possible to provide your script and data?
You can use our ftp for that:

http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP

Thanks,

--Mary

On Jan 4, 2013, at 6:04 PM, Kevin Vermeesch wrote:

> Hi Mary,
> You were correct, I was using ESMF_regrid_with_weights and not
> ESMF_regrid. I tried setting opt@DstGridType="Unstructured" and it gave
> the following output:
>
> (0) check_grid_type: invalid grid type
> (0) Warning: ESMF_copy_varcoords: don't recognize the grid type
> specified: 'Unstructured'. No coordinate information will be added.
> (0) check_for_y_lat_coord: Warning: Data either does not contain a
> valid latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' degree-north'
> 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN'
> 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a
> valid longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0) 'degrees_east' 'degrees-east' 'degree_east' degree-east'
> 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE'
> 'degreesE' 'deg east'
>
> The code I ran is below:
> outLat@units="degrees_N"
> outLon@units="degrees_E"
> gridOpt=True
> gridOpt@InterpMethod="patch"
> gridOpt@SrcRegional=True
> gridOpt@DstRegional=True
> gridOpt@DstGridType="Unstructured"
> srcGridName=str_concat((/"TWiLiTE_",flightName,\
> "_",model_name,"_sourceGrid1.nc"/))
> destGridName=str_concat((/"TWiLiTE_",flightName,\
> "_",model_name,"_destGrid1.nc"/))
> weightFileName=str_concat((/"TWiLiTE_",flightName,\
> "_",model_name,"_weights1.nc"/))
> curvilinear_to_SCRIP(srcGridName,lat,lon,gridOpt)
> rectilinear_to_SCRIP(destGridName,outLat,outLon,gridOpt)
> ESMF_regrid_gen_weights(srcGridName,destGridName,\
> weightFileName,gridOpt)
> Tsfc_regrid=ESMF_regrid_with_weights(Tsfc,weightFileName,gridOpt)
>
> lat and lon are 2D arrays and outLat and outLon are 1D arrays of equal
> length.
>
> Kevin
>
>
> On 1/2/2013 6:05 PM, Mary Haley wrote:
>> Hi Kevin,
>>
>> Thanks for your clear description of the issue, and I'm well aware
>> of it.
>>
>> This is an unfortunate part of trying to determine whether you
>> truly have unstructured data or rectilinear data. As far as I know,
>> the NetCDF file containing the weights does not provide this
>> information, so it's a guessing game at best.
>>
>> I assume you are using ESMF_regrid_with_weights and not
>> the all-in-one ESMF_regrid?
>>
>> If so, one thing you can try is setting:
>>
>> opt@DstGridType = "Unstructured"
>>
>> Can you let me know if this works?
>>
>> It looks like the ESMF_regrid_with_weights documentation doesn't mention this,
>> which is an oversight on my part. If you verify this works, then I'll be sure to
>> add this and highlight it.
>>
>> --Mary
>>
>> On Jan 2, 2013, at 1:07 PM, Kevin Vermeesch wrote:
>>
>>> Hi,
>>> I've found an issue in the
>>> $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl script that
>>> comes with NCL 6.1.0 and resolved it (at least for my use so far), so
>>> I'm e-mailing to make you aware of it.
>>>
>>> I was trying to regrid from a curvilinear to a rectilinear grid and kept
>>> getting the error:
>>>
>>> "write_grid_description: DstGridType and/or DstGridLat/DstGridLon were
>>> not set. Cannot determine the destination grid type."
>>>
>>> when I had the options attributes DstGridLat and DstGridLon set with
>>> values assigned to them. I found in the ESMF_regridding.ncl script where
>>> the error message was getting printed at and figured out why the code
>>> was getting there. It is near line 2904 where the script is trying to
>>> figure out the type of destination grid. In that section of code
>>> (testing for a rectilinear destination grid), the last condition of the
>>> "else if" statement tests lat_dims.ne.lon_dims. I was using 1D lat/lon
>>> arrays that happened to be the same length (my destination lat/lon
>>> arrays are dynamically generated in my script I use to call the ESMF
>>> functions), so the test for a destination rectilinear grid was false and
>>> the script was not able to determine the grid type.
>>>
>>> I'm not sure of the significance of lat_dims not being equal to
>>> lon_dims, but I commented-out that last condition in the else if
>>> statement (lat_dims.ne.lon_dims) on line 2906 and the program worked
>>> fine after that.
>>>
>>> Kevin
>>>
>>> --
>>> * * * * * * * * * * * *
>>> Kevin Vermeesch
>>> Science Systems and Applications, Inc.
>>> NASA/GSFC Code 612
>>> Building 33, Room C422
>>> e-mail: kevin.c.vermeesch@nasa.gov
>>> phone: (301) 614-6224
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> --
> * * * * * * * * * * * *
> Kevin Vermeesch
> Science Systems and Applications, Inc.
> NASA/GSFC Code 612
> Building 33, Room C422
> e-mail: kevin.c.vermeesch@nasa.gov
> phone: (301) 614-6224
>
> _______________________________________________
> 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 Mon Jan 7 08:46:56 2013

This archive was generated by hypermail 2.1.8 : Mon Jan 07 2013 - 08:57:08 MST