satpy.tests.reader_tests.test_grib module

Module for testing the satpy.readers.grib module.

class satpy.tests.reader_tests.test_grib.FakeGRIB(messages=None, proj_params=None, latlons=None)[source]

Bases: object

Fake GRIB file returned by pygrib.open.

Init the grib file.

message(msg_num)[source]

Get a message.

seek(loc)[source]

Seek.

class satpy.tests.reader_tests.test_grib.FakeMessage(values, proj_params=None, latlons=None, **attrs)[source]

Bases: object

Fake message returned by pygrib.open().message(x).

Init the message.

keys()[source]

Get message keys.

latlons()[source]

Get coordinates.

valid_key(key)[source]

Validate key.

class satpy.tests.reader_tests.test_grib.TestGRIBReader[source]

Bases: object

Test GRIB Reader.

static _get_fake_pygrib(proj_params, lon_corners, lat_corners)[source]
_get_test_datasets(dataids, fake_pygrib=None)[source]
setup_method()[source]

Wrap pygrib to read fake data.

teardown_method()[source]

Re-enable pygrib import.

test_area_def_crs(proj_params, lon_corners, lat_corners)[source]

Check that the projection is accurate.

test_file_pattern()[source]

Test matching of file patterns.

test_init()[source]

Test basic init with no extra parameters.

test_jscanspositively(proj_params, lon_corners, lat_corners)[source]

Check that data is flipped if the jScansPositively is present.

test_load_all(proj_params, lon_corners, lat_corners)[source]

Test loading all test datasets.

test_missing_attributes(proj_params, lon_corners, lat_corners)[source]

Check that the grib reader handles missing attributes in the grib file.

yaml_file = 'grib.yaml'
satpy.tests.reader_tests.test_grib._round_trip_projection_lonlat_check(area)[source]

Check that X/Y coordinates can be transformed multiple times.

Many GRIB files include non-standard projects that work for the initial transformation of X/Y coordinates to longitude/latitude, but may fail in the reverse transformation. For example, an eqc projection that goes from 0 longitude to 360 longitude. The X/Y coordinates may accurately go from the original X/Y metered space to the correct longitude/latitude, but transforming those coordinates back to X/Y space will produce the wrong result.

satpy.tests.reader_tests.test_grib.fake_gribdata()[source]

Return some faked data for use as grib values.