pmarchand1 / waver Goto Github PK
View Code? Open in Web Editor NEWR package to calculate fetch length and wave energy
R package to calculate fetch length and wave energy
Hello,
I'm sorry I'm still quite new to R.
I want to calculate the length of the fetch and so I used the "fetch_len_multi" function because I have several coordinates at the same time. I use the following code:
library("waver")
coord<- data.frame(longitude =dat$lon,
latitude = dat$lat)
coord
longitude latitude
1 -72.99792 46.76213
2 -72.99776 46.76221
3 -72.99760 46.76229
4 -72.99747 46.76238
5 -72.99736 46.76252
6 -72.99734 46.76267
7 -72.99710 46.76273
8 -72.99696 46.76282
spdf <- SpatialPoints(coords = coord,
proj4string = CRS("+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"))
x_coord <- c(-72.997825, -72.996194, -72.994381, -72.991173, -72.999176, -72.998307, -72.996269 )
y_coord <- c(46.764037, 46.764096, 46.763743, 46.761597, 46.762560, 46.761869, 46.761244)
xym = cbind(x_coord,y_coord)
p<- Polygon(xym)
ps = Polygons(list(p),1)
sps=SpatialPolygons(list(ps))
proj4string(sps)=CRS(("+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"))
fetch_len_multi(spdf, bearings=216, sps, dmax=50000,
spread=c(-7,0,7),
method="btree", projected="FALSE")
and I get NAs and 50000 :
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] NA NA NA 50000 50000 50000 50000 NA
So I tried to simply draw a spatial line :
x_coord<-c(-72.998994,-72.998329,-72.996301,-72.993587)
y_coord<-c(46.762464,46.761839,46.761281,46.761016)
a<-SpatialLines(list(Lines(Line(cbind(x_coord,y_coord)),ID="a")))
But I get the same...
Do you know what the problem is?
Thanks in advance !
You will be aware, for example from:
https://r-spatial.org/r/2022/04/12/evolution.html,
https://r-spatial.org/r/2022/12/14/evolution2.html,
https://r-spatial.org/r/2023/04/10/evolution3.html and
https://rsbivand.github.io/csds_jan23/bivand_csds_ssg_230117.pdf and
perhaps view https://www.youtube.com/watch?v=TlpjIqTPMCA&list=PLzREt6r1NenmWEidssmLm-VO_YmAh4pq9&index=1
that rgdal
, rgeos
and maptools
will be retired this
year, in October 2023.
waver
depends/imports 'rgdal', 'rgeos' rgeos::gBinarySTRtreeQuery rgeos::gDistance rgeos::gIntersection rgeos::gIntersects rgeos::gUnaryUnion, of which rgeos::gBinarySTRtreeQuery has no continuation - all sf
topological predicates and operations use indexing anyway. Please see https://r-spatial.org/r/2023/04/10/evolution3.html and https://github.com/r-spatial/evolution/blob/main/pkgapi_230305_refs.csv for suitable mitigations. Please fix best by June, latest October 2023.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.