def test_mask_crop_inverted_y(runner, tmpdir, basic_feature, pixelated_image_file):

    output = str(tmpdir.join('test.tif'))

    truth = numpy.zeros((4, 3))
    truth[1:3, 0:2] = 1

    result = runner.invoke(
        main_group, [
            'mask', pixelated_image_file, output, '--crop',
            '--geojson-mask', '-'],
        input=json.dumps(basic_feature))

    assert result.exit_code == 0
    assert os.path.exists(output)
    with rasterio.open(output) as out:
        assert numpy.array_equal(
            truth,
            out.read(1, masked=True).filled(0))
--crop option should also work if raster has a positive y pixel size
dataset/ETHPy150Open mapbox/rasterio/tests/test_rio_features.py/test_mask_crop_inverted_y