Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/dev-sf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:

steps:
- name: Checkout Project
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Build book
run: |
Rscript -e 'install.packages("geocompkg", repos = c("https://geocompr.r-universe.dev", "https://cloud.r-project.org"), dependencies = TRUE, force = TRUE)'
Rscript -e 'remotes::install_github("r-spatial/sf")'
Rscript -e 'remotes::install_github("r-spatial/stars")'
Rscript -e 'remotes::install_github("rspatial/terra")'
Rscript -e 'if (!requireNamespace("pak", quietly = TRUE)) install.packages("pak", repos = "https://cloud.r-project.org"); pak::pak("r-spatial/sf")'
Rscript -e 'if (!requireNamespace("pak", quietly = TRUE)) install.packages("pak", repos = "https://cloud.r-project.org"); pak::pak("r-spatial/stars")'
Rscript -e 'if (!requireNamespace("pak", quietly = TRUE)) install.packages("pak", repos = "https://cloud.r-project.org"); pak::pak("rspatial/terra")'
#Rscript -e 'remotes::install_github("geocompx/geocompkg", dependencies = TRUE, force = TRUE)'
Rscript -e 'bookdown::render_book("index.Rmd")'
18 changes: 18 additions & 0 deletions .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Scheduled
on:
schedule:
- cron: '0 6 * * 1' # every Monday at 06:00 UTC
workflow_dispatch:
jobs:
bookdown:
name: Render-Book
runs-on: ubuntu-latest
permissions:
contents: read
container: ghcr.io/geocompx/suggests:latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Render Book
run: Rscript -e 'bookdown::render_book("index.Rmd")'
7 changes: 3 additions & 4 deletions 08-read-write-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,12 @@ multilayer_rast = rast(multilayer_filepath)
All of the previous examples read spatial information from files stored on your hard drive.
However, GDAL also allows reading data directly from online resources, such as HTTP/HTTPS/FTP web resources.
The only thing we need to do is to add a `/vsicurl/` prefix before the path to the file.
Let's try it by connecting to the global monthly snow probability at 500-m resolution for the period 2000-2012.
Snow probability for December is stored as a Cloud Optimized GeoTIFF (COG) file (see Section \@ref(file-formats)) at [zenodo.org](https://zenodo.org/record/5774954/files/clm_snow.prob_esacci.dec_p.90_500m_s0..0cm_2000..2012_v2.0.tif).
Let's try it by connecting to a remote GeoTIFF hosted by [OSGeo](https://download.osgeo.org/geotiff/samples/usgs/o41078a5.tif).
This sample file is available online as a GeoTIFF (see Section \@ref(file-formats)).
Comment thread
Robinlovelace marked this conversation as resolved.
Outdated
To read an online file, we just need to provide its URL together with the `/vsicurl/` prefix.

```{r, linewidth=80}
myurl = paste0("/vsicurl/https://zenodo.org/record/5774954/files/",
"clm_snow.prob_esacci.dec_p.90_500m_s0..0cm_2000..2012_v2.0.tif")
myurl = "/vsicurl/https://download.osgeo.org/geotiff/samples/usgs/o41078a5.tif"
Comment thread
Robinlovelace marked this conversation as resolved.
Outdated
snow = rast(myurl)
snow
```
Expand Down
2 changes: 1 addition & 1 deletion code/chapters/08-read-write-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ multilayer_rast = rast(multilayer_filepath)


## ---------------------------------------------------------------------------------------------------
myurl = "/vsicurl/https://zenodo.org/record/5774954/files/clm_snow.prob_esacci.dec_p.90_500m_s0..0cm_2000..2012_v2.0.tif"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://zenodo.org/record/5774954/files/clm_snow.prob_esacci.dec_p.90_500m_s0..0cm_2000..2012_v2.0.tif is super slow and 140 MB. The new one is around 5 MB and much faster.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Robinlovelace -- I am not sure if this change is good. 1. Zenodo is unusually slow today -- in the past it was much faster consistently. 2. The idea in that code chunk is that we are not downloading the whole file (thus the file size does not matter) but we are just connecting to it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nowosad are you sure only part of the file gets downloaded? The next line is

snow = rast(myurl)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can try reverting it to see if actions pass in any case.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see the syntax now.. So yeah it only gets a bit I guess.

myurl = "/vsicurl/https://download.osgeo.org/geotiff/samples/usgs/o41078a5.tif"
Comment thread
Robinlovelace marked this conversation as resolved.
Outdated
snow = rast(myurl)
snow

Expand Down
Loading