[R-sig-Geo] Calculate the length of hail paths
St John Brown
st_john_brown at yahoo.com
Tue Oct 28 18:29:19 CET 2014
Frede and Barry,
Thank you very much for your responses. I spoke directly with the NOAA person responsible for maintaining the data. He said that the spatial lines do not represent paths, but point observations. I made an assumption that the lines were hail paths because there was no text describing the data. I close my question.
Thank you,
St. John
On Tuesday, October 28, 2014 4:47 AM, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
I downloaded the hail and tornado shapefile It looks like hailstorms in the original data files don't really move, except maybe one 10m grid square. This first one from 2013 goes nowhere:
Slot "coords":
[,1] [,2]
[1,] 185758.3 -246307.6
[2,] 185758.3 -246307.6
I reckon theyve tried to use the same format as the tornado data, which can have quite large differences between start and end point, but hailstorms are such a short intense event that the motion isn't important relative to the size.
So I don't think there's essentially any "track" information in the data, and it should be considered point events.
Barry
On Mon, Oct 27, 2014 at 2:49 PM, St John Brown <st_john_brown at yahoo.com> wrote:
Hello,
>
>I am trying to calculate the the length of the trajectory of historic hail storms in the United States. I have written the R code to do this but my results do not seem valid. The majority of my results are around 14 meters which does not seem correct.
>
>My data comes from the NOAA in the form of a shape file (hail.zip) [1]. When I read the shape file I have an object of class SpatialLinesDataframe. The individual lines represent the paths of the historic hail storms.
>
>Below I have created an example SpatialLines object with lines from the original data and my method for calculating the path length. As you can see the results are around 14 meters. Am I calculating the distances correctly?
>
>I appreciate any help!
>
>[1] http://www.spc.noaa.gov/gis/svrgis/
>
>library(sp)
>library(geosphere)
>
>#create example SpatialLines obj
>myLines1 = Lines(list(Line(matrix(c(-519049.1, -519039.1, -736427.4, -736417.4), nrow=2, ncol=2))), ID="1")
>myLines2 = Lines(list(Line(matrix(c(527165, 527175, 261338.5, 261348.5), nrow=2, ncol=2))), ID="2")
>proj_str_lcc = CRS("+proj=lcc +lat_1=33 +lat_2=45 +lat_0=39 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0")
>mySpLines = SpatialLines(list(myLines1,myLines2), proj4string=proj_str_lcc)
>
>#calculate distance of line paths
>proj.str.alb = CRS("+proj=longlat +datum=WGS84")
>mySpLines_alb = spTransform(mySpLines, CRS=proj.str.alb)
>
>res = lapply(slot(mySpLines_alb, "lines"), function(x) lapply(slot(x, "Lines"),function(y) slot(y, "coords")))
>
>f = function(i){
> end_pnts = unlist(res[i],use.names = F)
> p1 = end_pnts[c(1,3)]
> p2 = end_pnts[c(2,4)]
> return(distCosine(p1,p2)) #meters
>}
>
>d = sapply(1:length(res), FUN=f)
>
>> d
>[1] 14.14557 14.21278 #meters
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list