[ncl-talk] masking data with shapefile

Oluwaseun Ilori wilseun at gmail.com
Sun Apr 26 19:07:30 MDT 2020


Thanks so much Rick Brownrigg, I was able to solve the problem with the
help of printVarSummary() as you suggested. It made it easy for me to trace
and locate the source of the said errors in my scripts.

I was very lazy writing the script from scratch that's why I edited my old
script leading to the error.

Thanks so much once again.


On Sun, Apr 26, 2020, 4:30 PM Rick Brownrigg <brownrig at ucar.edu> wrote:

>
> Hi,
>
> You have a rather complex script that computes many derived variables.
> While it looks like the incoming data has proper coordinate variables, and
> it looks like you've taken care to call copy_VarCoords() in places, the
> root cause of the error message is that something doesn't have the
> coordinate variables expected by shapefile_mask_data(). Do you know which
> of the 48 calls to shapefile_mask_data() is throwing the error? Perhaps
> place a printVarSummary() on that variable before the call to make sure the
> variable is what you think it is.
>
> I would note that shapefile_mask_data() has very specific requirements for
> coordinate variables. This is from the comments embedded in the source code:
>
>   - If a rectilinear grid, then "data" must have coordinate arrays
> ;    attached.
> ;  - If a curvilinear grid, then "data" must have the special lat2d
> ;    and lon2d attributes attached.
> ;  - If a unstructured grid, then "data"must have the special lat1d
> ;    and lon1d attributes attached.
>
>
> And to be more specific, the section of code that throws the error message
> is below.
>
> Finally, the script looks like much of it is copy-paste construction --
> repetitive code for each derived variable. Perhaps one thing to try is to
> lift just the code associated with the problem variable out into a separate
> test script and see what it takes to get that working.
>
> Good luck,
> Rick
>
>  - - - - - - - -
>
> "data" is the first parameter to shapefile_mask_data():
>
>   grid_type = ""
>   if(rank.eq.2.and.\
>      isdimnamed(data,0).and.iscoord(data,data!0).and.\
>      isdimnamed(data,1).and.iscoord(data,data!1)) then
>     lat1d = ndtooned(conform_dims(dims,data&$data!0$,0))
>     lon1d = ndtooned(conform_dims(dims,data&$data!1$,1))
>     grid_type = "rectilinear"
>   else if(rank.eq.2.and.all(isatt(data,(/"lat2d","lon2d"/)))) then
> ;---Curvilinear
>     lat1d = ndtooned(data at lat2d)
>     lon1d = ndtooned(data at lon2d)
>     if(product(dims).eq.dimsizes(lat1d).and.\
>        product(dims).eq.dimsizes(lon1d)) then
>       grid_type = "curvilinear"
>     end if
>   else if(rank.eq.1.and.all(isatt(data,(/"lat1d","lon1d"/)))) then
> ;---Unstructured
>     lat1d = data at lat1d
>     lon1d = data at lon1d
>     if(dims.eq.dimsizes(lat1d).and.\
>        product(dims).eq.dimsizes(lon1d)) then
>       grid_type = "unstructured"
>     end if
>   end if
>   end if
>   end if
>
>   if(grid_type.eq."") then
>     print("shapefile_mask_data: Error: not a valid rectilinear,
> curvilinear, or unstructured grid")
>     exit
>   end if
>
> On Sat, Apr 25, 2020 at 10:39 AM Oluwaseun Ilori via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> I've been trying do some Mann-Kendall analysis and to calculate
>> coefficient of regression using shapefile of Nigeria using the attached
>> script until I got error message saying "*shapefile_mask_data: Error:
>> not a valid rectilinear, curvilinear, or unstructured grid*" I have
>> searched for help but could not find any. Since all my inputs data are
>> similar, I also attached output of ncl_filedump of one input since ncdump
>> keeps giving me unknown file form.
>>
>> thanks for your reply
>>
>> On Sat, Apr 25, 2020 at 4:47 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>>
>>> Hi -- did you perhaps forget the ncdump output?  IOf so, please reply to
>>> the group.
>>>
>>> On Sat, Apr 25, 2020 at 9:33 AM Oluwaseun Ilori via ncl-talk <
>>> ncl-talk at ucar.edu> wrote:
>>>
>>>> Good day  NCL users
>>>>
>>>> I've been trying do some Mann-Kendall analysis and to calculate
>>>> coefficient of regression using shapefile of Nigeria using the attached
>>>> script until I got error message saying "*shapefile_mask_data: Error:
>>>> not a valid rectilinear, curvilinear, or unstructured grid*" I have
>>>> searched for help but could not find any. Since all my inputs data are
>>>> similar, I also attached output of ncdump of one input.
>>>>
>>>> thanks for your reply
>>>>
>>>> --
>>>> *OLUWASEUN ILORI*
>>>> *M.Tech in Meteorology and climate science*
>>>>
>>>> *Phone: +2347031000687 +2348069154213*
>>>> *Federal University of Technology Akure. Nigeria.*
>>>> *Facebook: *http://facebook.com/hilorywilson
>>>> <https://www.facebook.com/hilorywilson>
>>>> linkedln: https://www.linkedin.com/in/wilson-ilori-447952108
>>>> Twitter: HiloryW
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> --
>> *OLUWASEUN ILORI*
>> *M.Tech in Meteorology and climate science*
>>
>> *Phone: +2347031000687 +2348069154213*
>> *Federal University of Technology Akure. Nigeria.*
>> *Facebook: *http://facebook.com/hilorywilson
>> <https://www.facebook.com/hilorywilson>
>> linkedln: https://www.linkedin.com/in/wilson-ilori-447952108
>> Twitter: HiloryW
>> _______________________________________________
>> 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/20200427/79cae329/attachment.html>


More information about the ncl-talk mailing list