Skip to content

Commit

Permalink
Merge pull request #70 from GeoscienceAustralia/curtainstuff
Browse files Browse the repository at this point in the history
Curtainstuff
  • Loading branch information
a2ray authored Mar 15, 2024
2 parents 3d99e5c + f07fedf commit 5608a22
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions zz_portalcurtains/RDP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module RDP
using LinearAlgebra, Dates, ArchGDAL, Printf,
PyPlot, Images, FileIO, HiQGA, Interpolations
import GeoFormatTypes as GFT
import GeoDataFrames as GDF
const mpl = PyPlot.matplotlib
const tilesize = 512
const epsg_GDA94 = 4283
Expand Down Expand Up @@ -311,6 +312,25 @@ function writevtkfromxyzrhodir(nlayers::Int; src_dir="", dst_dir="", src_epsg=0,
end
end

function writeshpfromxyzrhodir(nlayers::Int; prefix="", src_dir="", dst_dir="", src_epsg=0, writeesri=false)
lines = transD_GP.getprobabilisticlinesfromdirectory(src_dir)
isdir(dst_dir) || mkpath(dst_dir)
table = map(lines) do ln
X, Y, _ = transD_GP.readxyzrhoϕ(ln, nlayers; pathname=src_dir)
plist = makeplist(X, Y)
longlat = reverse.(reprojecttoGDA94(plist, src_epsg))
R = transD_GP.CommonToAll.cumulativelinedist(X,Y)
(;geom=ArchGDAL.createlinestring(longlat), Line=ln, Length=R[end], soundings_inverted=length(R))
end
if writeesri
fn = joinpath(dst_dir, prefix*".shp")
GDF.write(fn, table; geom_columns=(:geom,), crs=GFT.EPSG(epsg_GDA94))
else
fn = joinpath(dst_dir, prefix*".gpkg")
GDF.write(fn, table; geom_columns=(:geom,), crs=GFT.EPSG(epsg_GDA94))
end
end

function writeaseggdffromxyzrho(nlayers::Int; src_dir="", dst_dir="",
fname="", src_epsg=0)
isdir(dst_dir) || mkpath(dst_dir)
Expand Down
14 changes: 14 additions & 0 deletions zz_portalcurtains/makeshp_from_all_xyzrho.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using HiQGA, PyPlot
includet("RDP.jl")
nlayers = 52
rootdir = "/Users/anray/Documents/work/projects/largeaem/final_01/shapefiles/"
## multiple surveys
items = [item for item in walkdir("/Users/anray/Documents/work/projects/largeaem/final_01/summaries_all")]
idx_summary = [basename(it[1]) == "summary" for it in items]
src_dir = [it[1] for it in items[idx_summary]]
src_epsg = [28353, 28354, 28351, 28354, 28354, 28354, 28354, 28352, 28352, 28352, 28352]
map(zip(src_dir, src_epsg)) do (sdir, epsg)
parts = split(sdir,"/")
prefix = parts[end-2]*"_"*parts[end-1]
RDP.writeshpfromxyzrhodir(nlayers; prefix, src_dir=sdir, dst_dir=rootdir, src_epsg=epsg)
end

0 comments on commit 5608a22

Please sign in to comment.