Skip to content

Commit

Permalink
Merge pull request #59 from marujore/master
Browse files Browse the repository at this point in the history
SBSR2023 Corrections
  • Loading branch information
marujore authored Mar 30, 2023
2 parents aabbdef + d9bd9e0 commit ea92d4d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
39 changes: 33 additions & 6 deletions jupyter/R/stac/stac-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"outputs": [],
"source": [
"# Remove '#' to install packages\n",
"# install.packages(c(\"magrittr\", \"tibble\", \"dplyr\", \"raster\"), dependencies = FALSE)"
"# install.packages(c(\"magrittr\", \"tibble\", \"dplyr\", \"raster\", \"tmap\"), dependencies = FALSE)"
]
},
{
Expand Down Expand Up @@ -290,7 +290,7 @@
"## <span style=\"color:#336699\">Retrieving the Metadata of a Collection</span>\n",
"<hr style=\"border:1px solid #0077b9;\">\n",
"\n",
"The `collections()` function returns information about a given image or data cube collection identified by its name. In this example, we are retrieving information about the datacube collection `CB4_64_16D_STK-1`:\n"
"The `collections()` function returns information about a given image or data cube collection identified by its name. In this example, we are retrieving information about the datacube collection `CB4-16D-2`:\n"
]
},
{
Expand All @@ -304,7 +304,7 @@
"outputs": [],
"source": [
"collection_info <- stac_obj %>% \n",
" collections(\"CB4_64_16D_STK-1\") %>% \n",
" collections(\"CB4-16D-2\") %>% \n",
" get_request()\n",
"\n",
"print(collection_info)"
Expand Down Expand Up @@ -333,7 +333,7 @@
"outputs": [],
"source": [
"items <- stac_obj %>% \n",
" collections(\"CB4_64_16D_STK-1\") %>% \n",
" collections(\"CB4-16D-2\") %>% \n",
" items(datetime = \"2018-08-01/2019-07-31\",\n",
" bbox = c(-45.9, -12.9, -45.4, -12.6),\n",
" limit = 20) %>%\n",
Expand Down Expand Up @@ -502,6 +502,33 @@
"We are going to crop the image with a row and column window. To do this, we will create a `bbox` that satisfies this extension."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"source": [
"proj_orig <- sf::st_crs(\"+proj=longlat +datum=WGS84\")\n",
"#BDC proj4 string\n",
"proj_dest <- sf::st_crs(\"+proj=aea +lat_0=-12 +lon_0=-54 +lat_1=-2 +lat_2=-22 +x_0=5000000 +y_0=10000000 +ellps=GRS80 +units=m +no_defs\")\n",
"\n",
"pts <- tibble::tibble(\n",
" lon = c(-45.89957, -45.40046),\n",
" lat = c(-12.9142, -12.58579)\n",
")\n",
"pts_sf <- sf::st_as_sf(pts, coords = c(\"lon\", \"lat\"), crs = proj_orig)\n",
"pts_transf <- sf::st_transform(pts_sf, crs = proj_dest)\n",
"\n",
"lat_dest <- sf::st_coordinates(pts_transf)[, 2]\n",
"lon_dest <- sf::st_coordinates(pts_transf)[, 1]\n",
"\n",
"cat(\"Reprojected longitude:\", lon_dest, \"\\nReprojected latitude:\", lat_dest)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -590,7 +617,7 @@
"#\n",
"# creating a band composition\n",
"#\n",
"rgb <- c(red_rast_cropped, blue_rast_cropped, green_rast_cropped)\n",
"rgb <- c(red_rast_cropped, green_rast_cropped, blue_rast_cropped)\n",
"\n",
"#\n",
"# rgb view of the created composition\n",
Expand Down Expand Up @@ -930,7 +957,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Vejamos as *labels* resultantes da limiarização:"
"Lets now see *labels*:"
]
},
{
Expand Down
Loading

0 comments on commit ea92d4d

Please sign in to comment.