<div dir="ltr"><div><div><div><div><div><div><div>Do a:<br><br></div>printVarSummary(var)<br><br></div>and you'll know for sure. My guess is that, yes while "var" is a scalar field, as represented in a NetCDF file, it is defined at discrete points in time *and* space, and so is likely 3D?<br><br></div>I'm not expert at the regridding component -- but I think in your call to EMSF_regrid, it might look like this:<br><br></div> EMSF_regrid(var(0,:,:), Opts) <br><br></div>which would regrid over all of the spatial domain for the first time step.<br><br></div>Hope that helps, but punchline: print() or printVarSummary() is your friend! ;-)<br><br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 4:39 PM, Matthew Shultz <span dir="ltr"><<a href="mailto:matthew.shultz@yale.edu" target="_blank">matthew.shultz@yale.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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? <div><div class="h5"><br><div><br><br>
</div>
<br><div><div>On Jun 23, 2015, at 6:16 PM, Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><div><div>Hi Matthew,<br><br></div>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?<br><br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 3:31 PM, Matthew Shultz <span dir="ltr"><<a href="mailto:matthew.shultz@yale.edu" target="_blank">matthew.shultz@yale.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Here’s the output I get when I run the command. Line 40 in my file is just the call to ESMF_regrid</div><div>Thanks for you assistance</div><div><br></div><div><br></div><div>(0) get_src_grid_info: source lat dims = (277,349)</div><div>(0) get_src_grid_info: source lon dims = (277,349)</div><div>(0) get_src_grid_info: source grid type is 'curvilinear'</div><span><div>fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue</div><div><br></div></span><div>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 1614 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl</div><div><br></div><div>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3853 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl</div><div><br></div><div>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3983 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl</div><div><br></div><div>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 40 in file regrid3.ncl</div><div><div><div><br></div><div><br></div><div><br>
</div>
<br><div><div>On Jun 23, 2015, at 1:22 PM, Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">What line number does the error message refer to?<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 22, 2015 at 7:42 PM, Matthew Shultz <span dir="ltr"><<a href="mailto:matthew.shultz@yale.edu" target="_blank">matthew.shultz@yale.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Greetings,<div>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.</div><div><br></div><div><br></div><div><br></div><div>fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue</div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"</div><div><br></div><div>;---Data file containing source grid</div><div> src_file = "<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__air.sfc.2009.nc&d=AwMFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=uKbh2SXDxGKvLk5QzayNO82syruaWpicjIReiqrlroo&m=in-kyqdBB_SrcaUe8NduEiwvdug6jD8--IAlddvlGUM&s=ig9Wc1p8W1YxsWqkiFqci37YiabzbIhxeiyjz-uUzo0&e=" target="_blank">air.sfc.2009.nc</a>" ;;---Change (likely)</div><div> sfile = addfile(src_file,"r")</div><div><br></div><div>;---Get variable to regrid</div><div> varname = "air" ;;---Change (likely)</div><div> var = sfile->air</div><div> src_lat = sfile->lat ;;---Change (maybe)</div><div> src_lon = sfile->lon ;;---Change (maybe)</div><div><br></div><div>;---Set up regridding options</div><div> Opt = True</div><div><br></div><div>;---"bilinear" is the default. "patch" and "conserve" are other options.</div><div> Opt@InterpMethod = "bilinear" ;;---Change (maybe)</div><div><br></div><div> Opt@WgtFileName = "<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__curv-5Fto-5F1deg.nc&d=AwMFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=uKbh2SXDxGKvLk5QzayNO82syruaWpicjIReiqrlroo&m=in-kyqdBB_SrcaUe8NduEiwvdug6jD8--IAlddvlGUM&s=oV6qP_NZtJZUXIOpck3rcmPKZHuyxgh9R9EnWJKtr2Y&e=" target="_blank">curv_to_1deg.nc</a>"</div><div><br></div><div> Opt@SrcGridLat = src_lat ; source grid</div><div> Opt@SrcGridLon = src_lon</div><div> Opt@SrcRegional = True ;;--Change (maybe)</div><div> Opt@SrcInputFileName = src_file ; optional, but good idea</div><div> Opt@SrcMask2D = where(.not.ismissing(var),1,0) ; Necessary if has</div><div> ; missing values.</div><div><br></div><div> Opt@DstGridType = "0.5x0.5" ; Destination grid</div><div> ;Opt@DstLLCorner = (/-89.75d, 0.00d /) ;;--Change (likely)</div><div> ;Opt@DstURCorner = (/ 89.75d, 359.75d /) ;;--Change (likely)</div><div> Opt@DstRegional = True ;;--Change (maybe)</div><div><br></div><div> Opt@ForceOverwrite = True</div><div> Opt@PrintTimings = True</div><div> Opt@Debug = True</div></div><div><br></div><div><div> var_regrid = ESMF_regrid(var,Opt) ; Do the regridding</div><div><br></div><div> printVarSummary(var_regrid)</div></div><div><br></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=AwMFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=uKbh2SXDxGKvLk5QzayNO82syruaWpicjIReiqrlroo&m=in-kyqdBB_SrcaUe8NduEiwvdug6jD8--IAlddvlGUM&s=DBUC6JC9tObdztE4E4BXvNWNjeDLWWz5Tt8hQQUWF30&e=" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div>