Module: safe.storage.test_io

class safe.storage.test_io.Test_IO(methodName='runTest')[source]

Tests for reading and writing of raster and vector data

Xtest_reading_and_writing_of_multiband_rasters()[source]

Multiband rasters can be read and written correctly

Xtest_reading_and_writing_of_sqlite_vector_data()[source]

SQLite vector data can be read and written correctly

test_analysis_of_vector_data_top_N()[source]

Analysis of vector data - get top N of an attribute

test_array2wkt()[source]

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()[source]

Different attribute types are handled correctly in vector data

test_bad_ascii_data()[source]

ASC raster files with bad data causes good error message

This example is courtesy of Hyeuk Ryu

test_bins()[source]

Linear and quantile bins are correct

test_bounding_box_conversions()[source]

Bounding boxes can be converted between list and string

test_bounding_box_intersection()[source]

Intersections of bounding boxes work

test_buffered_bounding_box()[source]

Bounding box can be buffered

test_centroids_from_polygon_data()[source]

Centroid point data can be derived from polygon data

Test against centroid data generated by QGIS: shapefiles with a _centroids.shp suffix.

test_compatible_projections()[source]

Projections that are compatible but not identical are recognised

This is a test for issue #304

test_donut_polygons()[source]

Donut polygon can be read, interpreted and written correctly

test_empty_keywords_file()[source]

Empty keywords can be handled

test_geotransform2bbox()[source]

Bounding box can be extracted from geotransform

test_geotransform2resolution()[source]

Resolution can be extracted from geotransform

test_get_bounding_box()[source]

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)[source]

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

test_instantiation_of_empty_layers()[source]

Vector and Raster objects can be instantiated with None

test_keywords_file()[source]

Keywords can be written and read

test_keywords_with_colon()[source]

Keywords and values with colons raise error messages

test_layer_API()[source]

Vector and Raster instances have a similar API

test_line_to_points()[source]

Points along line are computed correctly

test_minimal_bounding_box()[source]

Bounding box minimal size can be controlled

test_multipart_polygon_raises_exception()[source]

Multipart polygons raise exception

test_no_projection()[source]

Raster layers with no projection causes Exception to be raised

test_nodata_value()[source]

NODATA value is correctly handled for GDAL layers

test_ordering_polygon_vertices()[source]

Ordering of polygon vertices is preserved when writing and reading

test_polygon_area()[source]

Polygon areas are computed correctly

test_polygon_centroids()[source]

Polygon centroids are computed correctly

test_polygons_with_inner_rings()[source]

Polygons with inner rings can be written and read

test_projection_comparisons()[source]

Projection information can be correctly compared

test_raster_extrema()[source]

Raster extrema (including NAN’s) are correct.

test_raster_to_vector_points()[source]

Raster layers can be converted to vector point layers

test_raster_to_vector_points2()[source]

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()[source]

Consistency of rasters and associated arrays

test_reading_and_writing_of_real_rasters()[source]

Rasters can be read and written correctly in different formats

test_reading_and_writing_of_vector_line_data()[source]

Vector line data can be read and written correctly

test_reading_and_writing_of_vector_point_data()[source]

Vector point data can be read and written correctly

test_reading_and_writing_of_vector_polygon_data()[source]

Vector polygon data can be read and written correctly

test_vector_class()[source]

Consistency of vector class for point data

test_vector_class_geometry_types()[source]

Admissible geometry types work in vector class

Also check that reported bounding boxes are correct

test_vector_extrema()[source]

Vector extremum calculation works

test_vector_feature_count()[source]

Number of features read from vector data is as expected

safe.storage.test_io.linear_function(x, y)[source]

Auxiliary function for use with raster test

This module forms part of the InaSAFE tool.

Previous topic

Module: safe.storage.layer

Next topic

Module: safe.storage.utilities_test

This Page