[ncl-talk] Shapefile_mask_data error

Mary Haley haley at ucar.edu
Mon Oct 1 14:06:03 MDT 2018


If I may jump in. This error:

fatal:Argument type mismatch on argument (1) of (shapefile_mask_data) can
not coerce


is indicating that the second argument (argument count starts at 0) is not
the correct expected type.

This argument is expecting the shapefile that's already been opened by
addfile, and not the name of the shapefile itself.

For example:

  shp_file  = "ne_10m_geography_regions_polys.shp"
  a         = addfile(shp_file,"r")
  opt = True
*  <...set possible "opt" options here...>*
  data_mask = shapefile_mask_data(data,shp_file,opt)

--Mary

On Fri, Sep 28, 2018 at 1:38 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hmmm...that all looks about right. Have you done a printVarSummary(var)
> to make sure that variable is what you think it is?
>
> Rick
>
> On Fri, Sep 28, 2018 at 1:01 PM Christian Adrián Álvarez Báez <
> christian.alvarez813 at gmail.com> wrote:
>
>> Hi, I'm triying to extract data with a mask from an WRF output using the
>> example shapefiles_19.ncl. I had many errors so looking I found some
>> modifications, including the shapefile_mask_data: Error: not a valid
>> rectilinear, curvilinear, or unstructured grid that I think it was solved
>> by using the copy_VarMeta function. But I'm stuck with the error:
>> fatal:Argument type mismatch on argument (1) of (shapefile_mask_data) can
>> not coerce
>> caused on line 60 of my script.
>> tc = wrf_user_getvar(a,"tc",it)
>> var=tc(0,:,:)
>> copy_VarMeta(tc,var)
>>
>> Line 60
>> data_keep = shapefile_mask_data(var,shp_filename,opt)
>>
>>
>> The script it's a little messy because of many modifications, I hope I
>> made sense. I don't know if the problem could be the shape, it's just a
>> simple polygon test projected on Lambert conformal conical as the WRF
>> output.
>>
>> I'm sending my script and my shape files if there is a clue.
>>
>> Thank you very much,
>> Christian
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
> _______________________________________________
> 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/20181001/91602a6e/attachment.html>


More information about the ncl-talk mailing list