Skip to content

Commit

Permalink
line length
Browse files Browse the repository at this point in the history
  • Loading branch information
lillythomas committed Mar 25, 2024
1 parent 9329d74 commit bcd8215
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docs/patch_level_cloud_cover.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
"outputs": [],
"source": [
"# Define area of interest\n",
"area_of_interest = shapely.box(xmin=bbox_bl[0], ymin=bbox_bl[1], xmax=bbox_tr[0], ymax=bbox_tr[1])\n",
"area_of_interest = shapely.box(\n",
" xmin=bbox_bl[0], ymin=bbox_bl[1], xmax=bbox_tr[0], ymax=bbox_tr[1])\n",
"\n",
"# Define temporal range\n",
"daterange: dict = [\"2021-01-01T00:00:00Z\", \"2021-12-31T23:59:59Z\"]"
Expand Down Expand Up @@ -159,9 +160,8 @@
"epsg = items_L2A[0].properties[\"proj:epsg\"]\n",
"\n",
"# Convert point from lon/lat to UTM projection\n",
"poidf = gpd.GeoDataFrame(crs=\"OGC:CRS84\", geometry=[area_of_interest.centroid]).to_crs(\n",
" epsg\n",
")\n",
"poidf = gpd.GeoDataFrame(crs=\"OGC:CRS84\", \n",
" geometry=[area_of_interest.centroid]).to_crs(epsg)\n",
"geom = poidf.iloc[0].geometry\n",
"\n",
"# Create bounds of the correct size, the model\n",
Expand Down Expand Up @@ -691,7 +691,9 @@
"# Function to get the average of some list of reference vectors\n",
"def get_average_vector(idxs):\n",
" reformatted_idxs = ['_'.join(map(str, idx)) for idx in idxs]\n",
" matching_rows = [tbl.to_pandas().query(f\"idx == '{idx}'\") for idx in reformatted_idxs]\n",
" matching_rows = [\n",
" tbl.to_pandas().query(f\"idx == '{idx}'\") for idx in reformatted_idxs\n",
" ]\n",
" matching_vectors = [row.iloc[0][\"vector\"] for row in matching_rows]\n",
" vector_mean = numpy.mean(matching_vectors, axis=0)\n",
" return vector_mean"
Expand Down Expand Up @@ -914,7 +916,8 @@
"result_non_cloudy_boxes = [\n",
" Polygon([(bbox[0], bbox[1]), (bbox[2], bbox[1]), (bbox[2], bbox[3]), (bbox[0], bbox[3])]) \n",
" for bbox in result_non_cloudy['box']]\n",
"result_non_cloudy_gdf = gpd.GeoDataFrame(result_non_cloudy, geometry=result_non_cloudy_boxes)\n",
"result_non_cloudy_gdf = gpd.GeoDataFrame(\n",
" result_non_cloudy, geometry=result_non_cloudy_boxes)\n",
"result_non_cloudy_gdf.crs = \"EPSG:4326\"\n",
"\n",
"# Plot the AOI in RGB\n",
Expand Down

0 comments on commit bcd8215

Please sign in to comment.