95k points at 0.125 degree resolution caused the GRIB2 extraction to take too long. 0.5 degree (~55 km) resolution gives 6k points which completes in under a minute. Can increase resolution later once the extraction is optimized.
56 lines
1.4 KiB
Elixir
56 lines
1.4 KiB
Elixir
defmodule Microwaveprop.Propagation.GridTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Microwaveprop.Propagation.Grid
|
|
|
|
describe "conus_points/0" do
|
|
test "generates grid at 0.5 degree resolution" do
|
|
points = Grid.conus_points()
|
|
assert length(points) > 5000
|
|
assert length(points) < 100_000
|
|
end
|
|
|
|
test "all points within CONUS bounds" do
|
|
Enum.each(Grid.conus_points(), fn {lat, lon} ->
|
|
assert lat >= 25.0 and lat <= 50.0
|
|
assert lon >= -125.0 and lon <= -66.0
|
|
end)
|
|
end
|
|
|
|
test "points are on 0.5 degree grid" do
|
|
Enum.each(Grid.conus_points(), fn {lat, lon} ->
|
|
assert Float.round(lat * 2, 0) == lat * 2
|
|
assert Float.round(lon * 2, 0) == lon * 2
|
|
end)
|
|
end
|
|
|
|
test "first point is at SW corner" do
|
|
[{lat, lon} | _] = Grid.conus_points()
|
|
assert lat == 25.0
|
|
assert lon == -125.0
|
|
end
|
|
|
|
test "last point is at NE corner" do
|
|
points = Grid.conus_points()
|
|
{lat, lon} = List.last(points)
|
|
assert lat == 50.0
|
|
assert lon == -66.0
|
|
end
|
|
end
|
|
|
|
describe "step/0" do
|
|
test "returns 0.5" do
|
|
assert Grid.step() == 0.5
|
|
end
|
|
end
|
|
|
|
describe "bounds/0" do
|
|
test "returns CONUS bounding box" do
|
|
bounds = Grid.bounds()
|
|
assert bounds.lat_min == 25.0
|
|
assert bounds.lat_max == 50.0
|
|
assert bounds.lon_min == -125.0
|
|
assert bounds.lon_max == -66.0
|
|
end
|
|
end
|
|
end
|