Skip to content

Commit d579a1b

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents ba9d096 + 22a03f9 commit d579a1b

File tree

4 files changed

+121
-343
lines changed

4 files changed

+121
-343
lines changed

Manifest.toml

Lines changed: 0 additions & 336 deletions
This file was deleted.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PSHAModelBuilder"
22
uuid = "2be8aca4-be12-4446-a1ed-019ced9bed6a"
33
authors = ["Marco <[email protected]>"]
4-
version = "0.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

src/seismicity/boxcounting.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@ using Printf
44
using TOML
55
using DataFrames
66

7+
8+
# Define compatibility shim if `geoToH3` doesn't exist, but `latLngToCell` does
9+
# Conditionally define GeoCoord at compile-time (valid and recommended)
10+
@static if !@isdefined(GeoCoord)
11+
@info "Defining GeoCoord compatibility struct"
12+
struct GeoCoord
13+
lat::Float64 # in radians
14+
lon::Float64 # in radians
15+
end
16+
end
17+
18+
# Runtime conditional method definition (always allowed)
19+
if !(@isdefined geoToH3) && (@isdefined latLngToCell)
20+
@info "Defining geoToH3 compatibility shim"
21+
function geoToH3(coord::GeoCoord, res::Integer)
22+
#if res isa Int32
23+
# res = Int64(res)
24+
#end
25+
return latLngToCell(LatLng(coord.lat, coord.lon), res)
26+
end
27+
28+
function h3ToGeo(cell_id)
29+
lat_lng_rad = cellToLatLng(cell_id)
30+
GeoCoord(lat_lng_rad.lat, lat_lng_rad.lng)
31+
end
32+
end
33+
34+
735
function get_gr_params(config::Dict, source_id::String)
836
"""
937
get_gr_params(config, source_id

0 commit comments

Comments
 (0)