Skip to content

Commit

Permalink
cache station metadata since timeout from GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
bbest committed Jan 12, 2024
1 parent bd1a4b0 commit 0c0a909
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 14 additions & 7 deletions data.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,24 @@ Got token at [ncdc.noaa.gov/cdo-web/token](https://www.ncdc.noaa.gov/cdo-web/tok
- `TMIN`: Minimum temperature (tenths of degrees C)

```{r}
#| label: weather-station
#| label: fig-weather-station
# provide NOAA key
options(noaakey = Sys.getenv("NOAA_NCDC_CDO_token"))
# Specify datasetid and station
stn <- "GHCND:USW00012842" # TAMPA INTERNATIONAL AIRPORT, FL US
stn_csv <- here("data/tpa_ghcnd.csv")
stn_meta <- ncdc_stations(
datasetid = "GHCND",
stationid = stn)
stn_meta$data
stn_csv <- here("data/tpa_ghcnd.csv")
stn_meta_csv <- here("data/tpa_meta.csv")
if (!file.exists(stn_meta_csv)){
# cache station metadata since timeout from Github Actions
stn_meta <- ncdc_stations(
datasetid = "GHCND",
stationid = stn)
write_csv(stn_meta$data, stn_meta_csv)
}
read_csv(stn_meta_csv)
if (!file.exists(stn_csv)){
Expand Down Expand Up @@ -207,6 +212,8 @@ Types of data:
* [NOAA / NESDIS / STAR - Laboratory for Satellite Altimetry / Sea Level Rise](https://www.star.nesdis.noaa.gov/socd/lsa/SeaLevelRise/LSA_SLR_maps.php)

```{r}
#| label: fig-slr-satellite
slr_nc <- here("data/slr/slr_map_txj1j2.nc")
r_slr_gcs <- rast(slr_nc) # 0.5 degree resolution
r_slr_mer <- projectRasterForLeaflet(r_slr_gcs, method="bilinear")
Expand Down
2 changes: 2 additions & 0 deletions data/tpa_meta.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
elevation,mindate,maxdate,latitude,name,datacoverage,id,elevationUnit,longitude
1.8,1939-02-01,2024-01-09,27.96331,"TAMPA INTERNATIONAL AIRPORT, FL US",1,GHCND:USW00012842,METERS,-82.54

0 comments on commit 0c0a909

Please sign in to comment.