Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,14 @@ jobs:
version: '1.12'
allow_failure: true
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
- uses: julia-actions/cache@v2
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
include-matrix: false
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-processcoverage@v1
Expand Down
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeophysicalModelGenerator"
uuid = "3700c31b-fa53-48a6-808a-ef22d5a84742"
version = "0.7.17"
authors = ["Boris Kaus", "Marcel Thielmann"]
version = "0.7.16"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -22,6 +22,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Expand Down Expand Up @@ -65,6 +66,7 @@ LightXML = "0.8, 0.9"
MeshIO = "0.1 - 0.5"
NCDatasets = "0.14"
NearestNeighbors = "0.2 - 0.4"
ParallelTestRunner = "2"
Parameters = "0.9 - 0.12"
SpecialFunctions = "1.0, 2"
StaticArrays = "1"
Expand Down
2 changes: 1 addition & 1 deletion ext/Gmsh_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Reads a Gmsh file and returns a `FEData` object with info about the mesh. `tag_n
"""
function import_Gmsh(fname::String)

mesh = GmshDiscreteModel(fname, renumber = false)
mesh = GmshDiscreteModel(fname, renumber = false, has_affine_map = false)

# Extract vertices
nverts = length(mesh.grid.node_coordinates)
Expand Down
6 changes: 3 additions & 3 deletions src/IO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GeoData
"""
function load_GMG(filename::String, dir = pwd(); maxattempts = 5)

local_filename = "download_GMG_temp.jld2"
local_filename = "download_GMG_temp_$(getpid()).jld2"
if contains(filename, "http")
file_ext = download_data(filename, local_filename, dir = dir, maxattempts = maxattempts)
else
Expand All @@ -72,7 +72,7 @@ function load_GMG(filename::String, dir = pwd(); maxattempts = 5)

# remove local temporary file
if contains(filename, "http")
rm(local_filename)
rm(joinpath(dir, local_filename), force = true)
end

return data
Expand Down Expand Up @@ -118,4 +118,4 @@ function download_data(url::String, local_filename = "temp.dat"; dir = pwd(), ma
end

return file_ext
end
end
4 changes: 1 addition & 3 deletions src/ProfileProcessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function create_profile_screenshot!(Profile::ProfileData, DataSet::NamedTuple)
x_profile = flatten_cross_section(data_tmp, Start = Profile.start_lonlat) # compute the distance along the profile
data_tmp = addfield(data_tmp, "x_profile", x_profile)

# add the data set as a NamedTuple
# add the data set as a NamedTuple
data_NT = NamedTuple{(DataSetName[idata],)}((data_tmp,))
tmp = merge(tmp, data_NT)
else
Expand Down Expand Up @@ -414,8 +414,6 @@ function extract_ProfileData!(Profile::ProfileData, VolData::Union{Nothing, GeoD
end




"""
This reads the picked profiles from disk and returns a vector of ProfileData
"""
Expand Down
10 changes: 5 additions & 5 deletions src/data_import.jl
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,15 @@ function tomo_2_GeoData(filename::String; vel_type::String = "vs")

# Extract the variables
depth = data["depth"][:]
lon = data["longitude"][:]
lat = data["latitude"][:]
vel = data[vel_type][:,:,:]
lon = data["longitude"][:]
lat = data["latitude"][:]
vel = data[vel_type][:, :, :]

# create lon, lat, depth grid
Lon, Lat, Depth = lonlatdepth_grid(lon, lat, .- depth)

# create GeoData struct
Tomo_data = GeoData(Lon, Lat, Depth, (vel=vel,))
Tomo_data = GeoData(Lon, Lat, Depth, (vel = vel,))

return Tomo_data
end
end
115 changes: 18 additions & 97 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,104 +1,25 @@
using GeophysicalModelGenerator
using Test
using ParallelTestRunner

@testset verbose = true "GeophysicalModelGenerator" begin
testsuite = find_tests(@__DIR__)

@testset "Data import.jl" begin
include("test_data_import.jl")
end
@testset "Data types.jl" begin
include("test_data_types.jl")
end
@testset "Paraview" begin
include("test_paraview.jl")
end
@testset "Paraview collection" begin
include("test_paraview_collection.jl")
end
@testset "Gravity model" begin
include("test_voxel_gravity.jl")
end
@testset "Nearest points" begin
include("test_nearest_points.jl")
end
@testset "Utils" begin
include("test_utils.jl")
end
@testset "Transformations" begin
include("test_transformation.jl")
end
@testset "Surfaces" begin
include("test_surfaces.jl")
end

@testset "LaMEM" begin
include("test_lamem.jl")
end

@testset "pTatin" begin
include("test_pTatin_IO.jl")
end

@testset "SetupGeometry" begin
include("test_setup_geometry.jl")
end

@testset "STL" begin
include("test_stl.jl")
end

@testset "IO" begin
include("test_IO.jl")
end

@testset "ProfileProcessing" begin
include("test_ProfileProcessing.jl")
end

@testset "GMT integration" begin
include("test_GMT.jl")
end

@testset "Gmsh integration" begin
include("test_Gmsh.jl")
end

@testset "Event counts" begin
include("test_event_counts.jl")
end
@testset "Create movie" begin
include("test_create_movie.jl")
end

@testset "Sea level" begin
include("test_sea_level.jl")
end

@testset "Ridge Thermal Structure Tests" begin
include("test_ridge_segments.jl")
end

@testset "Plate Tests" begin
include("test_plate.jl")
end

@testset "Waterflow" begin
include("test_WaterFlow.jl")
end

@testset "ASAGI_IO" begin
include("test_ASAGI_IO.jl")
# Add `using GeophysicalModelGenerator` to each test
for (name, expr) in testsuite
if name != "test_tutorials" # Tutorials are standalone
testsuite[name] = quote
using GeophysicalModelGenerator
$expr
end
end
end

@testset "Chmy" begin
include("test_Chmy.jl")
try
ParallelTestRunner.runtests(GeophysicalModelGenerator, ARGS; testsuite)
finally
# Cleanup
foreach(f -> rm(joinpath(@__DIR__, f)), filter(endswith(".vts"), readdir(@__DIR__)))
foreach(f -> rm(joinpath(@__DIR__, f)), filter(endswith(".vtu"), readdir(@__DIR__)))
if isdir(joinpath(@__DIR__, "markers"))
rm(joinpath(@__DIR__, "markers"), recursive = true)
end
end

# Include tutorials
include("test_tutorials.jl")

# Cleanup
foreach(rm, filter(endswith(".vts"), readdir()))
foreach(rm, filter(endswith(".vtu"), readdir()))
rm("./markers/", recursive = true)
2 changes: 1 addition & 1 deletion test/test_setup_geometry.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# test setting geometries in the different grid types
using Test, GeophysicalModelGenerator, GeoParams
using Test, GeophysicalModelGenerator, GeoParams, Statistics

# GeoData
Lon3D, Lat3D, Depth3D = lonlatdepth_grid(1.0:1:10.0, 11.0:1:20.0, (-20:1:-10) * km);
Expand Down
Loading