### Navigation

- index
- modules
- next
- previous
- Home »
- Contents »
- InaSAFE’s API documentation »
- Package::safe »
- Package::safe.storage »

# Module: safe.storage.test_io

class `safe.storage.test_io.``Test_IO`(methodName='runTest')

  Tests for reading and writing of raster and vector data

  `Xtest_reading_and_writing_of_multiband_rasters`()

    Multiband rasters can be read and written correctly

  `Xtest_reading_and_writing_of_sqlite_vector_data`()

    SQLite vector data can be read and written correctly

  `test_analysis_of_vector_data_top_N`()

    Analysis of vector data - get top N of an attribute

  `test_array2wkt`()

    Conversion to wkt data works

    It should create something like this
      ‘POLYGON((0 1, 2 3, 4 5, 6 7, 8 9))’
  `test_attribute_types`()

    Different attribute types are handled correctly in vector data

  `test_bad_ascii_data`()

    ASC raster files with bad data causes good error message

    This example is courtesy of Hyeuk Ryu

  `test_bins`()

    Linear and quantile bins are correct

  `test_bounding_box_conversions`()

    Bounding boxes can be converted between list and string

  `test_bounding_box_intersection`()

    Intersections of bounding boxes work

  `test_buffered_bounding_box`()

    Bounding box can be buffered

  `test_centroids_from_polygon_data`()

    Centroid point data can be derived from polygon data

    Test againts centroid data generated by qgis: named *_centroids.shp

  `test_compatible_projections`()

    Projections that are compatible but not identical are recognised

    This is a test for issue #304

  `test_donut_polygons`()

    Donut polygon can be read, interpreted and written correctly

  `test_empty_keywords_file`()

    Empty keywords can be handled

  `test_geotransform2bbox`()

    Bounding box can be extracted from geotransform

  `test_geotransform2resolution`()

    Resolution can be extracted from geotransform

  `test_get_bounding_box`()

    Bounding box is correctly extracted from file.

    # Reference data: gdalinfo Earthquake_Ground_Shaking_clip.tif Driver: GTiff/GeoTIFF Files: Earthquake_Ground_Shaking_clip.tif Size is 345, 263 Coordinate System is: GEOGCS[“WGS 84”,

    > DATUM[“WGS_1984”,
    >   SPHEROID[“WGS 84”,6378137,298.2572235630016,
    >     AUTHORITY[“EPSG”,”7030”]],

    >   AUTHORITY[“EPSG”,”6326”]],

    > PRIMEM[“Greenwich”,0], UNIT[“degree”,0.0174532925199433], AUTHORITY[“EPSG”,”4326”]]

    Origin = (99.364169565217395,-0.004180608365019) Pixel Size = (0.008339130434783,-0.008361216730038) Metadata:

    > AREA_OR_POINT=Point TIFFTAG_XRESOLUTION=1 TIFFTAG_YRESOLUTION=1 TIFFTAG_RESOLUTIONUNIT=1 (unitless)

    Image Structure Metadata:
      COMPRESSION=LZW INTERLEAVE=BAND

    Corner Coordinates: Upper Left ( 99.3641696, -0.0041806) ( 99d21‘51.01”E, 0d 0‘15.05”S) Lower Left ( 99.3641696, -2.2031806) ( 99d21‘51.01”E, 2d12‘11.45”S) Upper Right ( 102.2411696, -0.0041806) (102d14‘28.21”E, 0d 0‘15.05”S) Lower Right ( 102.2411696, -2.2031806) (102d14‘28.21”E, 2d12‘11.45”S) Center ( 100.8026696, -1.1036806) (100d48‘9.61”E, 1d 6‘13.25”S) Band 1 Block=256x256 Type=Float64, ColorInterp=Gray

    Note post gdal 1.8 it is Upper Left ( 99.3600000, 0.0000000) ( 99d21‘36.00”E, 0d 0’ 0.01”N) Lower Left ( 99.3600000, -2.1990000) ( 99d21‘36.00”E, 2d11‘56.40”S) Upper Right ( 102.2370000, 0.0000000) (102d14‘13.20”E, 0d 0’ 0.01”N) Lower Right ( 102.2370000, -2.1990000) (102d14‘13.20”E, 2d11‘56.40”S) Center ( 100.7985000, -1.0995000) (100d47‘54.60”E, 1d 5‘58.20”S)

  `test_i18n`(*args, **kwargs)

    Test to see if internationalisation is working correctly. Make sure to include this file when using xgettext to scan for translatable strings. .. see:: `i18n`

  `test_instantiation_of_empty_layers`()

    Vector and Raster objects can be instantiated with None

  `test_keywords_file`()

    Keywords can be written and read

  `test_keywords_with_colon`()

    Keywords and values with colons raise error messages

  `test_layer_API`()

    Vector and Raster instances have a similar API

  `test_line_to_points`()

    Points along line are computed correctly

  `test_minimal_bounding_box`()

    Bounding box minimal size can be controlled

  `test_multipart_polygon_raises_exception`()

    Multipart polygons raise exception

  `test_no_projection`()

    Raster layers with no projection causes Exception to be raised

  `test_nodata_value`()

    NODATA value is correctly handled for GDAL layers

  `test_ordering_polygon_vertices`()

    Ordering of polygon vertices is preserved when writing and reading

  `test_polygon_area`()

    Polygon areas are computed correctly

  `test_polygon_centroids`()

    Polygon centroids are computed correctly

  `test_polygons_with_inner_rings`()

    Polygons with inner rings can be written and read

  `test_projection_comparisons`()

    Projection information can be correctly compared

  `test_raster_extrema`()

    Raster extrema (including NAN’s) are correct.

  `test_raster_to_vector_points`()

    Raster layers can be converted to vector point layers

  `test_raster_to_vector_points2`()

    Raster layers can be converted to vector point layers (real data)

    # See qgis project in test data: raster_point_and_clipping_test.qgs

  `test_rasters_and_arrays`()

    Consistency of rasters and associated arrays

  `test_reading_and_writing_of_real_rasters`()

    Rasters can be read and written correctly in different formats

  `test_reading_and_writing_of_vector_line_data`()

    Vector line data can be read and written correctly

  `test_reading_and_writing_of_vector_point_data`()

    Vector point data can be read and written correctly

  `test_reading_and_writing_of_vector_polygon_data`()

    Vector polygon data can be read and written correctly

  `test_vector_class`()

    Consistency of vector class for point data

  `test_vector_class_geometry_types`()

    Admissible geometry types work in vector class

    Also check that reported bounding boxes are correct

  `test_vector_extrema`()

    Vector extremum calculation works

  `test_vector_feature_count`()

    Number of features read from vector data is as expected

`safe.storage.test_io.``linear_function`(x, y)

  Auxiliary function for use with raster test

This module forms part of the InaSAFE tool.

### Navigation

- index
- modules
- next
- previous
- Home »
- Contents »
- InaSAFE’s API documentation »
- Package::safe »
- Package::safe.storage »