wradlib.io.to_AAIGrid

wradlib.io.to_AAIGrid(*args, **kwargs)

Write a cartesian grid to an Arc/Info ASCII grid file.

New in version 0.6.0.

The function writes a text file to fpath that contains the header info and the grid data passed with the argument data. Find details on ESRI grids (or Arc/Info ASCII grids) on wikipedia [B7]. This should work for most GIS software systems (tested for QGIS and ESRI ArcGIS).

In case a GDAL SpatialReference object (argument proj) is passed, the function will also try to write an accompanying projection (.prj) file that has the same file name, but a different extension.

Please refer to wradlib.georef to see how to create SpatialReference objects from e.g. EPSG codes epsg_to_osr, PROJ.4 strings proj4_to_osr, or WKT strings wkt_to_osr. Other projections are addressed by create_osr.

Parameters:
  • fpath (string) – a file path - must have a “.txt” or “.asc” extension.
  • data (numpy.array) – two dimensional numpy array of type integer or float
  • xllcorner (float) – x coordinate of the lower left corner of the grid
  • yllcorner (float) – y coordinate of the lower left corner of the grid
  • cellsize (float) – size of the grid cells - needs to be consistent with proj
  • nodata (float) – no data flag
  • proj (osr.SpatialReference) – a SpatialReference of class ‘osr.SpatialReference’
  • fmt (string) – format string
  • to_esri (bool) – set True if the prj file should be made ESRI compatible

Note

Has been tested with ESRI ArcGIS 9.3 and QGIS 2.8.

Examples

See Export a dataset in GIS-compatible format.