[ncl-talk] Using NCL to Regrid NetCDF data for ArcGIS
Matthew Shultz
matthew.shultz at yale.edu
Tue Jun 23 16:39:21 MDT 2015
That sounds like it could be right, but I guess I don’t understand NetCDF that well. This file contains a year of daily data on air quality, which is a scalar stored in var. So the value of ‘var’ is 1D for each daily time-step, but obviously air + time is 2D. In order to get this to regrid correctly, is there a way I need to express that in my ncl code?
On Jun 23, 2015, at 6:16 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:
> Hi Matthew,
>
> I don't know for certain, but tracking down where the error messages are coming from, it looks like perhaps your variable "var" is not of the same dimensions as lat/lon (which are clearly 2D). Is there a time or level dimension perhaps associated with var?
>
> Rick
>
>
> On Tue, Jun 23, 2015 at 3:31 PM, Matthew Shultz <matthew.shultz at yale.edu> wrote:
> Here’s the output I get when I run the command. Line 40 in my file is just the call to ESMF_regrid
> Thanks for you assistance
>
>
> (0) get_src_grid_info: source lat dims = (277,349)
> (0) get_src_grid_info: source lon dims = (277,349)
> (0) get_src_grid_info: source grid type is 'curvilinear'
> fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 1614 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3853 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3983 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 40 in file regrid3.ncl
>
>
>
>
> On Jun 23, 2015, at 1:22 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> What line number does the error message refer to?
>>
>>
>>
>> On Mon, Jun 22, 2015 at 7:42 PM, Matthew Shultz <matthew.shultz at yale.edu> wrote:
>> Greetings,
>> I am very new to netcdf and need some assistance. I am trying to calculate zonal statistics (sums and averages within watershed shapes) using some tools in ArcGIS for netcdf. The tools require netcdf files to be in a regular grid. My source data is NARR data, which isn't being recognized as a regular grid (I believe it is curvilinear). So I am trying to regrid using templates provided on the ucar website. Attached is the code I am currently using. It gives me the following error. Despite search archives of this list, other responses have not resolved my problem. Help is very much appreciated, clearly there is something I am not understanding.
>>
>>
>>
>> fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue
>>
>>
>>
>>
>> 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"
>>
>> ;---Data file containing source grid
>> src_file = "air.sfc.2009.nc" ;;---Change (likely)
>> sfile = addfile(src_file,"r")
>>
>> ;---Get variable to regrid
>> varname = "air" ;;---Change (likely)
>> var = sfile->air
>> src_lat = sfile->lat ;;---Change (maybe)
>> src_lon = sfile->lon ;;---Change (maybe)
>>
>> ;---Set up regridding options
>> Opt = True
>>
>> ;---"bilinear" is the default. "patch" and "conserve" are other options.
>> Opt at InterpMethod = "bilinear" ;;---Change (maybe)
>>
>> Opt at WgtFileName = "curv_to_1deg.nc"
>>
>> Opt at SrcGridLat = src_lat ; source grid
>> Opt at SrcGridLon = src_lon
>> Opt at SrcRegional = True ;;--Change (maybe)
>> Opt at SrcInputFileName = src_file ; optional, but good idea
>> Opt at SrcMask2D = where(.not.ismissing(var),1,0) ; Necessary if has
>> ; missing values.
>>
>> Opt at DstGridType = "0.5x0.5" ; Destination grid
>> ;Opt at DstLLCorner = (/-89.75d, 0.00d /) ;;--Change (likely)
>> ;Opt at DstURCorner = (/ 89.75d, 359.75d /) ;;--Change (likely)
>> Opt at DstRegional = True ;;--Change (maybe)
>>
>> Opt at ForceOverwrite = True
>> Opt at PrintTimings = True
>> Opt at Debug = True
>>
>> var_regrid = ESMF_regrid(var,Opt) ; Do the regridding
>>
>> printVarSummary(var_regrid)
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150623/63df887f/attachment.html
More information about the ncl-talk
mailing list