Comments (7)
@DorotheaDeus, would you be able to share some of the site locations from the CSV? It'll help to know what area of the world this is exploring. Thanks!
from climater.
@DorotheaDeus, would you be able to share some of the site locations from the CSV? It'll help to know what area of the world this is exploring. Thanks!
Thank you for your quick response. I am trying to download just a for single point in a csv file. Sorry I am a newbie I don't know how to attach a file, but the file consist of a single, station located in northern Tanzania, East Africa with the following coordinate;
Babati | Lat | Lon
1 | -4.2078 | 35.7461
I would like to download also for more than one station, unfortunately I don't know how, could you please share with me any a kind of script to download multiple station from a csv or txt file.
I have been also trying to download for the whole country, Tanzania but it is not working, I am getting the same error.
Thank you in advance.
from climater.
Hi, so with the current version of climateR
the s2 issues are fixed. Remember that terraclimate
only goes back to 1958, so the 1918 date was likely causing your issue. Otherwise, here's a sample to tackle some of your goals:
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.3.0, PROJ 8.0.1
library(dplyr)
library(raster)
library(climateR)
library(ggplot2)
# Get AOI
AOI = AOI::aoi_get(country = 'Tanzania')
# Get PPT rasters
Babati.ppt = getTerraClim(AOI = AOI::aoi_get(country = 'Tanzania'),
param = 'prcp',
startDate = "1958-01-01",
endDate = "1958-12-31")
#> Spherical geometry (s2) switched off
#> Spherical geometry (s2) switched on
#Check
plot(Babati.ppt$terraclim_prcp)
# Make some random points (use yours!)
pts = st_sample(AOI, 100) %>%
st_as_sf() %>%
mutate(ID = 1:n())
# Check
plot(Babati.ppt$terraclim_prcp[[1]])
plot(pts, add = TRUE, pch = 16)
# Extract timeseries
ts = extract_sites(Babati.ppt, pts, "ID")
# Check
ts[[1]] %>%
tidyr::pivot_longer(-date) %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line() +
theme(legend.position = "none")
Created on 2021-08-03 by the reprex package (v2.0.0)
from climater.
Hi, so with the current version of
climateR
the s2 issues are fixed. Remember thatterraclimate
only goes back to 1958, so the 1918 date was likely causing your issue. Otherwise, here's a sample to tackle some of your goals:library(sf) #> Linking to GEOS 3.9.1, GDAL 3.3.0, PROJ 8.0.1 library(dplyr) library(raster) library(climateR) library(ggplot2) # Get AOI AOI = AOI::aoi_get(country = 'Tanzania') # Get PPT rasters Babati.ppt = getTerraClim(AOI = AOI::aoi_get(country = 'Tanzania'), param = 'prcp', startDate = "1958-01-01", endDate = "1958-12-31") #> Spherical geometry (s2) switched off #> Spherical geometry (s2) switched on #Check plot(Babati.ppt$terraclim_prcp)# Make some random points (use yours!) pts = st_sample(AOI, 100) %>% st_as_sf() %>% mutate(ID = 1:n()) # Check plot(Babati.ppt$terraclim_prcp[[1]]) plot(pts, add = TRUE, pch = 16)# Extract timeseries ts = extract_sites(Babati.ppt, pts, "ID") # Check ts[[1]] %>% tidyr::pivot_longer(-date) %>% ggplot(aes(x = date, y = value, color = name)) + geom_line() + theme(legend.position = "none")Created on 2021-08-03 by the reprex package (v2.0.0)
Thank you so much, I appreciate your assistance
from climater.
Hello sorry for bothering, I have this file I was trying to create a simple feature, sf file but I couldn't succeed,
STNs.csv
then I tried to import it as vector so as to extract the data at multiple sites below
Archive.zip
but when I try to extract I am getting more than 20 sites, how can I extract correct just the 20 sites I have. How can I associate with the station name instead of station Id.
Tried also to plot I could not succeeed.
This is how I did,
How can I change the color of the raster plotted?
I have 20 station points but the ts has more site, I don"t know why? How can I rename them with their station name, these are actual meteorological stations.
lastly sorry for bothering I didn't understand the functions used to plot, I tried to search but I couldn't see, please assist
I would like to put a legend with the station names, how can I change the color of the lines
I hope you will find some time to assist. Any idea would be appreciated.
Thank you in advance
from climater.
Hi, thanks for documenting your efforts. Please try something like this:
library(ggplot2)
library(dplyr)
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.3.0, PROJ 8.0.1
library(climateR)
stns = read.csv("/Users/mjohnson/Downloads/STNs.csv") %>%
st_as_sf(coords = c('Lon', 'Lat'), crs = 4326)
Babati.ppt = getTerraClim(AOI = stns,
param = 'prcp',
startDate = "1958-01-01",
endDate = "1958-12-31")
#> Spherical geometry (s2) switched off
#> Spherical geometry (s2) switched on
ext = extract_sites(Babati.ppt, stns, id = 'S_Name')
ext$terraclim_prcp %>%
tidyr::pivot_longer(-date) %>%
mutate(value = as.numeric(value)) %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line() +
# Change colors (example)
scale_color_viridis_d() +
theme_bw() +
theme(legend.position = "bottom")
Created on 2021-08-05 by the reprex package (v2.0.0)
from climater.
Thank you so much
from climater.
Related Issues (20)
- Error in masking HOT 1
- getGLDAS error "Access denied" HOT 19
- We are missing an ensemble filter. HOT 1
- Add utility to animate outputs HOT 5
- devtools::check() error found in test-netrc.R HOT 1
- Daymet return data date range is off by 1 HOT 2
- Add Average Option to PRISM Air Temperature HOT 2
- Odd dates returned HOT 2
- Added "../.." duration support in the catalog.
- Best way to get prism data for a single point HOT 2
- Question on using the precip data HOT 10
- Question: Is there a way to get annual means from gridMET data using getGridMet?
- getGridMET returns url with class "glue" "character" HOT 4
- no more srad data from TerraClim? HOT 9
- getGridMET returns error when embedded within another function HOT 2
- Accept sfc again
- Trouble Downloading over large area with SpatVect AOI HOT 8
- Question and Help: On How to Plot Monthly Data into Yearly Data In Tempreture change Map using getTerra climate HOT 11
- Problem download MODIS data
- ClimateR freezes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from climater.