Skip to content

Instantly share code, notes, and snippets.

@fivejjs
Created April 13, 2021 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fivejjs/72c495e686708c581a147817e37c509f to your computer and use it in GitHub Desktop.
Save fivejjs/72c495e686708c581a147817e37c509f to your computer and use it in GitHub Desktop.
Find the odd tiles from the odc dscache csv.
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