ropensci / rnoaa

R interface to many NOAA data APIs
https://docs.ropensci.org/rnoaa
Other
330 stars 84 forks source link

tests for swdi and changes to isd_stations #239

Closed kev-ho closed 6 years ago

kev-ho commented 6 years ago

Description

isd_stations changed to have consistent variable names "out" instead of "stations"

Radius test fails on my machine. But the logic seems sound. I think the data needs to be investigated

Related Issue

208

sckott commented 6 years ago

@kevin-ht-ho i think you worked on the swdi tests, yes? This one test is failing now https://travis-ci.org/ropensci/rnoaa/builds/296388194#L2108 Looking at it locally, Reduce("&",coordinates$distance < radius * 1.609344) returns FALSE, so the test fails.

Any thoughts?

kev-ho commented 6 years ago

@sckott When I wrote this test it didn't pass. But from what I can tell its actually a problem with the function itself (or the documentation describing what it should be returning).

The test is for swdi events that occur within a radius of a GPS location.

I just used the example in the documentation as the test case

# Get all 'nx3tvs' within 15 miles of latitude = 32.7 and longitude = -102.0
out <- swdi(dataset='nx3tvs', 
startdate='20060506', 
enddate='20060507', 
radius=15, 
center=c(-102.0,32.7))

If I just look at the "shape" variable of the output I get the following.

> out$shape
                                        shape
1  POINT (-101.126934590189 34.4896389449586)
2  POINT (-98.648742711054 36.4111067927992)
...
... <Truncated for brevity>
...
25 POINT (-101.177025256003 33.0567904388579)

When I measured the distance between the points (using meteo_spherical_distance()) and the center, they're all over 15 miles (24km) with the furthest point being, the second point returned is 514km away.

sckott commented 6 years ago

thanks @kevin-ht-ho - Okay, sounds like something is amiss. Will look into this and see if the fxn needs fixing, or something else

sckott commented 6 years ago

@kevin-ht-ho opened an issue https://github.com/ropensci/rnoaa/issues/243

seems like those values from meteo_spherical_distance are in km, not miles, but still those values are too large.