Created
April 13, 2021 23:58
-
-
Save fivejjs/72c495e686708c581a147817e37c509f to your computer and use it in GitHub Desktop.
Find the odd tiles from the odc dscache csv.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
import pandas as pd | |
df_new = pd.read_csv('s2_l2a_all.csv') # add absolut path of csv | |
xy_t = defaultdict(list) | |
for row in df_2019.itertuples(): | |
xy_t[(row.X, row.Y)].append(row.T) | |
tiles = { | |
"type": "FeatureCollection", | |
"features": [] | |
} | |
for k, values in xy_t.items(): | |
if len(values) != 2: | |
print(k) | |
gb = africa10.tile_geobox(k) | |
bbx = gb.geographic_extent.boundingbox | |
xmin, ymin, xmax, ymax = bbx.left, bbx.bottom, bbx.right, bbx.top | |
data = { "type": "Feature", | |
"properties": {"x": k[0], "y": k[0]}, | |
"geometry": { | |
"type": "Polygon", | |
"coordinates": [ | |
[ [xmin, ymin], [xmin, ymax], [xmax, ymax], | |
[xmax, ymin], [xmin, ymin] ] | |
] | |
} | |
} | |
tiles['features'].append(data) | |
with open('all_odd_tiles.geojson', 'w') as fh: | |
json.dump(tiles, fh, indent=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment