[ncl-talk] Not a recognized type

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Nov 16 15:00:02 MST 2021


NCL currently reads only OGR data types Integer, Integer64, Real, and
String from shapefiles.  In particular, OGR types Date and DateTime are
*not* supported.

You might be able to read that variable with the help of an external
program, ogrinfo <https://gdal.org/programs/ogrinfo.html>.  It is part of
GDAL <https://gdal.org>.  If you have it installed, then first test this on
the unix command line.  The spaces inside the single quotes are important.

    ogrinfo -al -geom=NO 610temp_latest.shp | grep ' Fcst_Date '

If that works, then invoke it within NCL, and extract only the data values,
like this:

    cmd = "ogrinfo -al -geom=NO 610temp_latest.shp | grep ' Fcst_Date '  |
cut -f2 -d="
    fdate = str_strip (systemfunc (cmd))

Test that command to ensure that it is reading fields in the same order as
NCL.  If not, you might try using one of the *ogrinfo* query options, and
looping over the field dimension.


On Sun, Nov 14, 2021 at 8:59 PM Andrew Kren - NOAA Federal via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Has anyone found a possible workaround for reading a variable from a file
> (shapefile) in which the recognized type (none) is not known?
>
> On Sun, Oct 31, 2021 at 12:50 PM Andrew Kren - NOAA Federal <
> andrew.kren at noaa.gov> wrote:
>
>> Hi there,
>>
>> I am plotting shapefile data from a shapefile. Two of the variables that
>> show up when doing an ncl_filedump have 'none' in front of the names,
>> meaning that ncl does not know the type, be it string, float, integer, etc.
>> When I tried to grab the variable, not surprisingly I got the error message,
>>
>> fatal:Variable <Fcst_Date> in file <610temp_latest> does not have a
>> recognized type: cannot get value
>>
>>
>> Is there a way to get around this and retrieve the variable? Or am I
>> stuck? I tried to look online to see if others had this issue but was not
>> able to find anything.
>>
>> Thanks,
>> --
>>
>> Andrew Kren
>> Meteorologist
>> NOAA's National Weather Service
>> Raleigh Forecast Office
>> 1005 Capability Drive, Suite 300
>> Raleigh, North Carolina 27606
>> voice: 919-326-1035
>> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20211116/f5c34a09/attachment.html>


More information about the ncl-talk mailing list