NCAR / ncl

The NCAR Command Language (NCL) is a scripting language for the analysis and visualization of climate and weather data.

Home Page:http://www.ncl.ucar.edu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for OGR data type Date in shapefiles

Dave-Allured opened this issue · comments

Some shapefiles are now (2021) being generated with OGR data type Date. NCL versions up through 6.6.2 are not able to read this data type. See this recent request from an NCL user, and discussion.
https://mailman.ucar.edu/pipermail/ncl-talk/2021-November/018532.html

Symptoms

  • With ncl_filedump: Data type "none" is printed for Date variables.

  • With addfile: Error is printed:

fatal:Variable <var name> in file <file name> does not have a recognized type: cannot get value

Requested solution
Add support for reading OGR data type Date, through addfile and the normal built-in NCL shapefile driver. On input, convert values of OGR type Date to NCL type string in the format YYYY/MM/DD.

Alternatives
A workaround is to read this data type indirectly with systemfunc and the ogrinfo utility program, as described in the above ncl-talk message. This is inferior because it is complicated and has a risk of reading Date variables in a different array order than data read normally through addfile.

Reference
Description of GDAL shapefile driver:
https://gdal.org/drivers/vector/shapefile.html

Under "Creation Issues", note the comment about supported and unsupported OGR data types. NCL uses GDAL to read shapefiles. Therefore, any data type unsupported in GDAL must also be unsupported in NCL.