From ee8addf04aac5bd3469fe6717c26c6fef60a7b5f Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Mon, 6 May 2024 17:45:32 -0500 Subject: [PATCH] neic-finitefault: adding new package and dependencies (#44032) * neic-finitefault: adding new package * py-obspy: adding new package * py-okada-wrapper: adding new package * py-pygmt: adding new package * py-pyrocko: adding new package --------- Signed-off-by: Shane Nehring --- .../fortran-filename-length.patch | 370 ++++++++++++++++++ .../packages/neic-finitefault/package.py | 142 +++++++ .../builtin/packages/py-obspy/package.py | 36 ++ .../packages/py-okada-wrapper/package.py | 28 ++ .../builtin/packages/py-pygmt/package.py | 31 ++ .../builtin/packages/py-pyrocko/package.py | 31 ++ 6 files changed, 638 insertions(+) create mode 100644 var/spack/repos/builtin/packages/neic-finitefault/fortran-filename-length.patch create mode 100644 var/spack/repos/builtin/packages/neic-finitefault/package.py create mode 100644 var/spack/repos/builtin/packages/py-obspy/package.py create mode 100644 var/spack/repos/builtin/packages/py-okada-wrapper/package.py create mode 100644 var/spack/repos/builtin/packages/py-pygmt/package.py create mode 100644 var/spack/repos/builtin/packages/py-pyrocko/package.py diff --git a/var/spack/repos/builtin/packages/neic-finitefault/fortran-filename-length.patch b/var/spack/repos/builtin/packages/neic-finitefault/fortran-filename-length.patch new file mode 100644 index 0000000000..c89ec14dcb --- /dev/null +++ b/var/spack/repos/builtin/packages/neic-finitefault/fortran-filename-length.patch @@ -0,0 +1,370 @@ +diff --git a/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_gf.f95 b/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_gf.f95 +index a87100b..658decf 100644 +--- a/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_gf.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_gf.f95 +@@ -139,9 +139,9 @@ contains + real omega, block, lat_e, lon_e, lat_s(nnsta), lon_s(nnsta), dt, depth, & + & weig, df, dt_sample, w, tlen + complex z0, z +- character(len=80) path ++ character(len=255) path + character(len=6) sta_name(nnsta) +- character(len=80) filename ++ character(len=255) filename + character(len=3) component(nnsta), comp + + z0 = cmplx(0.0, 0.0) +@@ -244,9 +244,9 @@ contains + real omega, block, lat_e, lon_e, lat_s(nnsta), lon_s(nnsta), dt, depth, & + & weig, df, dt_sample, w, low_freq, tlen + complex z0, z +- character(len=80) path ++ character(len=255) path + character(len=6) sta_name(nnsta) +- character(len=80) filename ++ character(len=255) filename + character(len=3) component(nnsta), comp + + z0 = cmplx(0.0, 0.0) +@@ -572,8 +572,8 @@ contains + complex :: kahan_y, kahan_t, kahan_c + complex sour_sub(npth), green_s(inptd, 10), www, wss, z0 + +- character(len=250) modes +- character(len=100) surf_gf_bank ++ character(len=255) modes ++ character(len=255) surf_gf_bank + character(len=6) sta_name(nnsta) + + z0 = cmplx(0.0, 0.0) +@@ -776,9 +776,9 @@ contains + & gf_imag(inptd), h, time, tsub(nnxy_m), a + complex z0, z, sour_sub(npth) + complex :: kahan_y, kahan_t, kahan_c +- character(len=80) path ++ character(len=255) path + character(len=6) sta_name(nnsta) +- character(len=80) filename ++ character(len=255) filename + + z0 = cmplx(0.0, 0.0) + n_chan3 = 0 +diff --git a/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_surf_gf.f95 b/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_surf_gf.f95 +index 6123151..416d81d 100644 +--- a/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_surf_gf.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/docs/src/retrieve_surf_gf.f95 +@@ -15,8 +15,8 @@ contains + + subroutine get_surf_gf_data(gf_file, gf_bank) + implicit none +- character(len=100), intent(in) :: gf_file +- character(len=100), intent(out) :: gf_bank ++ character(len=255), intent(in) :: gf_file ++ character(len=255), intent(out) :: gf_bank + integer :: int2, int3, int4 + open(1, file=gf_file) + read(1, *) npt_bank, dt_bank, int2, int3, int4, nfmax, nblock2 +@@ -36,7 +36,7 @@ contains + !! Load to memory GF bank, from a specified location. + !! + implicit none +- character(len=100) :: gf_bank ++ character(len=255) :: gf_bank + real :: d_min, d_max, z_min, z_max + integer :: nx_b, nx_e, nz_b, nz_e, ixx, izz + integer :: index_rec +diff --git a/fortran_code/bin_inversion_gfortran_f95/get_stations_data.f95 b/fortran_code/bin_inversion_gfortran_f95/get_stations_data.f95 +index e47dea1..e6bd2d7 100755 +--- a/fortran_code/bin_inversion_gfortran_f95/get_stations_data.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/get_stations_data.f95 +@@ -153,8 +153,8 @@ contains + & n_wave_weight, stations, channels0, int1, int2, used_channels + real dt, weig(max_stations), wavelet_weight0(11), dt_sample, lat_s, lon_s + logical, parameter :: dart = .False. +- character(len=20) filename, string2, string1 +- character(len=30) event_file, channels_file, wavelets_file, waveforms_file ++ character(len=255) filename, string2, string1 ++ character(len=255) event_file, channels_file, wavelets_file, waveforms_file + logical :: is_file, strong, cgps + ! character(len=6) sta_name(max_stations) + ! character(len=3) component(max_stations) +@@ -258,7 +258,7 @@ contains + real lat_sta, lon_sta, wavelet_weight0(11), dt, & + & rang, az, angle, float1, float2 + logical, parameter :: cgps=.False., dart = .False. +- character(len=20) filename, string1, string2 ++ character(len=255) filename, string1, string2 + character(len=30) event_file + character(len=6) earth, sttyp + character(len=14) fname +@@ -361,10 +361,10 @@ contains + & weig(max_stations, 3), wavelet_weight0(11), dt_sample, & + & dip, rake, theta + logical, parameter :: cgps=.False., dart=.False. +- character(len=20) filename, string1, string2 ++ character(len=255) filename, string1, string2 + character(len=30) event_file + ! character(len=6) sta_name(max_stations) +- character(len=250) modes ++ character(len=255) modes + logical :: is_file + + write(*,*)'Get stations metadata and waveforms for long period surface waves...' +@@ -469,7 +469,7 @@ contains + & n_wave_weight, stations, channels0, int1, int2, used_channels + real :: lat_s, lon_s, dt, weig(max_stations), wavelet_weight0(11), dt_sample + logical, parameter :: cgps=.False., dart=.True. +- character(len=20) filename ++ character(len=255) filename + ! character(len=6) sta_name(max_stations) + ! character(len=3) component(max_stations) + +@@ -544,7 +544,7 @@ contains + integer first, channel, i, j, channels0 + real :: dto + character(len=40) string +- character(len=20) filename ++ character(len=255) filename + + filename = trim(filename) + open(13, file=filename, status='old') +diff --git a/fortran_code/bin_inversion_gfortran_f95/retrieve_gf.f95 b/fortran_code/bin_inversion_gfortran_f95/retrieve_gf.f95 +index b37efeb..a47ffcd 100755 +--- a/fortran_code/bin_inversion_gfortran_f95/retrieve_gf.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/retrieve_gf.f95 +@@ -116,7 +116,7 @@ contains + & l, k, event + real :: omega, factor, start, dt, df, dt_sample, tlen + complex :: z0, z +- character(len=80) filename, filename2 ++ character(len=255) filename, filename2 + character(len=3) comp + character(len=1) channel2 + character(len=2) event2 +@@ -414,8 +414,8 @@ contains + complex :: kahan_y, kahan_t, kahan_c + complex start(wave_pts), green_s(wave_pts2, 10), green_dip0, green_stk0, z0 + +- character(len=250) modes +- character(len=100) surf_gf_bank ++ character(len=255) modes ++ character(len=255) surf_gf_bank + character(len=6) sta_name1 + logical :: many_events + +@@ -632,7 +632,7 @@ contains + & k, l, etc + real :: omega, dt, df, dt_sample, start, tlen, real1, imag1, time + complex :: z0, z +- character(len=80) filename ++ character(len=255) filename + + write(*,*)'Store DART GF in memory...' + z0 = cmplx(0.0, 0.0) +diff --git a/fortran_code/bin_inversion_gfortran_f95/retrieve_surf_gf.f95 b/fortran_code/bin_inversion_gfortran_f95/retrieve_surf_gf.f95 +index e07e1f3..bfc5250 100755 +--- a/fortran_code/bin_inversion_gfortran_f95/retrieve_surf_gf.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/retrieve_surf_gf.f95 +@@ -20,8 +20,8 @@ contains + ! gf_bank: location of GF bank + ! + implicit none +- character(len=100), intent(in) :: gf_file +- character(len=100), intent(out) :: gf_bank ++ character(len=255), intent(in) :: gf_file ++ character(len=255), intent(out) :: gf_bank + integer :: int2, int3, int4 + open(1, file=gf_file, status='old') + read(1, *) npt_bank, dt_bank, int2, int3, int4, nfmax, nblock2 +@@ -71,7 +71,7 @@ contains + ! z_max: maximum depth to get GF from Gf bank + ! + implicit none +- character(len=100) :: gf_bank ++ character(len=255) :: gf_bank + real :: d_min, d_max, z_min, z_max + integer :: nx_b, nx_e, nz_b, nz_e, ixx, izz + integer :: index_rec +diff --git a/fortran_code/bin_inversion_gfortran_f95/save_forward.f95 b/fortran_code/bin_inversion_gfortran_f95/save_forward.f95 +index 987b115..b626166 100755 +--- a/fortran_code/bin_inversion_gfortran_f95/save_forward.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/save_forward.f95 +@@ -114,7 +114,7 @@ contains + real*8 t1, t2, df + complex forward(wave_pts2), z0, z + complex :: source2(wave_pts, max_rise_time_range, max_rise_time_range) +- character(len=70) filename, filename2 ++ character(len=255) filename, filename2 + character(len=3) comp!component(max_stations), comp + logical :: strong, cgps + +diff --git a/fortran_code/bin_inversion_gfortran_f95/static_data.f95 b/fortran_code/bin_inversion_gfortran_f95/static_data.f95 +index 9e5bc3a..28e9085 100755 +--- a/fortran_code/bin_inversion_gfortran_f95/static_data.f95 ++++ b/fortran_code/bin_inversion_gfortran_f95/static_data.f95 +@@ -52,7 +52,7 @@ contains + real :: cosal, sinal, angle + real*8 :: disp + logical is_file, is_file2, many_events +- character(len=30) :: event_file, string1, string2 ++ character(len=255) :: event_file, string1, string2 + ! + inquire( file = 'static_data.txt', exist = is_file ) + if (is_file) then +diff --git a/fortran_code/bin_str_f95/get_stations_data.f95 b/fortran_code/bin_str_f95/get_stations_data.f95 +index 49e5788..a43990c 100755 +--- a/fortran_code/bin_str_f95/get_stations_data.f95 ++++ b/fortran_code/bin_str_f95/get_stations_data.f95 +@@ -66,7 +66,7 @@ contains + & n_wave_weight, ir_max, n_chan, & + & nos(nnsta), io_mod(nnsta), n_chan3 + real dt, weig(nnsta), j_wig(11), dt_sample, lat_s, lon_s +- character(len=20) filename ++ character(len=255) filename + ! character(len=6) sta_name(nnsta) + ! character(len=3) component(nnsta) + +@@ -144,7 +144,7 @@ contains + & n_wave_weight, ir_max, n_chan, & + & nos(nnsta), io_mod(nnsta), n_chan3 + real :: lat_s, lon_s, dt, weig(nnsta), j_wig(11), dt_sample +- character(len=20) filename ++ character(len=255) filename + ! character(len=6) sta_name(nnsta) + ! character(len=3) component(nnsta) + +@@ -221,7 +221,7 @@ contains + & nos, n_chan3, idts, nstaon, love, int1 + real lat_sta, lon_sta, j_wig(11), dt, & + & rang, az, earth_angle, disp_or_vel(nnsta), float1, float2 +- character(len=20) filename ++ character(len=255) filename + character(len=6) earth, sttyp + character(len=14) fname + +@@ -303,9 +303,9 @@ contains + real lat_s(nnsta), lon_s(nnsta), dt, & + & ang_ns(nnsta), ang_ew(nnsta), weig(nnsta, 3), j_wig(11), dt_sample, & + & dip, rake, theta +- character(len=20) filename ++ character(len=255) filename + ! character(len=6) sta_name(nnsta) +- character(len=250) modes ++ character(len=255) modes + + n_chan3 = 0 + ! +@@ -401,7 +401,7 @@ contains + integer ll_in, ll_out, ll_g, j_con(11), k, ir, no, & + & n_wave_weight, ir_max, n_chan, nos, io_mod, n_chan3 + real :: lat_s, lon_s, dt, weig(nnsta), j_wig(11), dt_sample +- character(len=20) filename ++ character(len=255) filename + ! character(len=6) sta_name(nnsta) + ! character(len=3) component(nnsta) + +@@ -476,7 +476,7 @@ contains + real cr(inptd), cz(inptd), obser(n_data), & + & dto, amp_max, obse(n_data, nnsta) + character(len=40) string +- character(len=20) filename ++ character(len=255) filename + + filename = trim(filename) + open(13, file=filename, status='old') +diff --git a/fortran_code/bin_str_f95/get_strong_motion.f95 b/fortran_code/bin_str_f95/get_strong_motion.f95 +index ff6f158..b13e734 100755 +--- a/fortran_code/bin_str_f95/get_strong_motion.f95 ++++ b/fortran_code/bin_str_f95/get_strong_motion.f95 +@@ -14,10 +14,10 @@ program get_strong_motion + use bpfilter, only : bandpassfilter + use rad_pattern, only : rad_coef + implicit none +- character(len=100) :: vel_model, gf_file, vel_file, gf_bank, filter_file, wave_file, stat_file ++ character(len=255) :: vel_model, gf_file, vel_file, gf_bank, filter_file, wave_file, stat_file + character(len=70) :: string1, input +- character(len=200) :: directory,filterfile,risetimefile,pointsourcefile +- character(len=200) :: channelsfile,waveformsfile,responsefile ++ character(len=255) :: directory,filterfile,risetimefile,pointsourcefile ++ character(len=255) :: channelsfile,waveformsfile,responsefile + character(len=10) :: sta_name(200) + character(len=12) :: filename + character(len=3) :: comp +diff --git a/fortran_code/bin_str_f95/retrieve_gf.f95 b/fortran_code/bin_str_f95/retrieve_gf.f95 +index 6a80593..fac8795 100755 +--- a/fortran_code/bin_str_f95/retrieve_gf.f95 ++++ b/fortran_code/bin_str_f95/retrieve_gf.f95 +@@ -22,8 +22,8 @@ contains + ! vel_model: file with velocity model + ! + implicit none +- character(len=100), intent(in) :: gf_file +- character(len=100), intent(out) :: vel_model, gf_bank ++ character(len=255), intent(in) :: gf_file ++ character(len=255), intent(out) :: vel_model, gf_bank + open(1, file=gf_file, status='old') + read(1, *)vel_model + read(1, *)dep_max, dep_min, dep_step +@@ -44,7 +44,7 @@ contains + ! z_max: maximum depth of point sources + ! + implicit none +- character(len=100) :: gf_bank ++ character(len=255) :: gf_bank + real :: z_min, z_max + integer :: npt, nx_b, nx_e, nz_b, nz_e, ixx, izz + integer :: index_rec +diff --git a/fortran_code/bin_str_f95/store_gf.f95 b/fortran_code/bin_str_f95/store_gf.f95 +index b544795..8b92bc7 100644 +--- a/fortran_code/bin_str_f95/store_gf.f95 ++++ b/fortran_code/bin_str_f95/store_gf.f95 +@@ -81,7 +81,7 @@ contains + ! disp: True if data to be used is cGPS, False otherwise + ! + implicit none +- character(len=100) :: filter_file, wave_file, stat_file, event_file ++ character(len=255) :: filter_file, wave_file, stat_file, event_file + character(len=70) :: string1, string2 + real :: lat_e, lon_e, dep_e + integer :: ir, no +diff --git a/fortran_code/src_dc_f95/green_bank_fk.f95 b/fortran_code/src_dc_f95/green_bank_fk.f95 +index aed84e9..76db003 100644 +--- a/fortran_code/src_dc_f95/green_bank_fk.f95 ++++ b/fortran_code/src_dc_f95/green_bank_fk.f95 +@@ -20,7 +20,7 @@ program green_bank_fk + integer iz, k, ll, n_com, nd_max, npt, ntc, nx, nz + logical :: disp + +- character(len=100) gf_file, vel_model, gf_bank, input ++ character(len=255) gf_file, vel_model, gf_bank, input + ! + call getarg(1, input) + disp = (input.eq.'cgps') +diff --git a/fortran_code/src_dc_f95/green_bank_fk_openmp.f95 b/fortran_code/src_dc_f95/green_bank_fk_openmp.f95 +index 4d89e33..3f819b1 100644 +--- a/fortran_code/src_dc_f95/green_bank_fk_openmp.f95 ++++ b/fortran_code/src_dc_f95/green_bank_fk_openmp.f95 +@@ -20,7 +20,7 @@ program green_bank_fk_openmp + integer iz, k, ll, n_com, nd_max, npt, ntc, nx, nz + logical :: disp + +- character(len=100) gf_file, vel_model, gf_bank, input, directory ++ character(len=255) gf_file, vel_model, gf_bank, input, directory + ! + call getarg(1, input) + call getarg(2, directory) +diff --git a/fortran_code/src_dc_f95/retrieve_gf.f95 b/fortran_code/src_dc_f95/retrieve_gf.f95 +index 94191d6..555ec59 100755 +--- a/fortran_code/src_dc_f95/retrieve_gf.f95 ++++ b/fortran_code/src_dc_f95/retrieve_gf.f95 +@@ -24,8 +24,8 @@ contains + ! gf_bank: location of GF bank + ! + implicit none +- character(len=100), intent(in) :: gf_file +- character(len=100), intent(out) :: vel_model, gf_bank ++ character(len=255), intent(in) :: gf_file ++ character(len=255), intent(out) :: vel_model, gf_bank + open(1, file=gf_file, status='old') + read(1, *)vel_model + read(1, *)dep_max, dep_min, dep_step diff --git a/var/spack/repos/builtin/packages/neic-finitefault/package.py b/var/spack/repos/builtin/packages/neic-finitefault/package.py new file mode 100644 index 0000000000..a27283e371 --- /dev/null +++ b/var/spack/repos/builtin/packages/neic-finitefault/package.py @@ -0,0 +1,142 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class NeicFinitefault(PythonPackage): + """Wavelet and simulated Annealing SliP inversion (WASP). + This code uses a nonlinear simulated annealing inversion method to + model slip amplitude, rake, rupture time, and rise time on a discretized + fault plane, finding the solution that best fits the observations in + the wavelet domain.""" + + homepage = "https://code.usgs.gov/ghsc/neic/algorithms/neic-finitefault" + + url = "https://code.usgs.gov/ghsc/neic/algorithms/neic-finitefault/-/archive/0.1.0/neic-finitefault-0.1.0.tar.gz" + git = "https://code.usgs.gov/ghsc/neic/algorithms/neic-finitefault" + + maintainers("snehring") + + license("CC0-1.0", checked_by="snehring") + + version("20240410", commit="ef6a1a92d60549100885112e24a18e38d8d4ce0b") + version("0.1.0", sha256="36b400dfc418bf78a3099f6fc308681c87ae320e6d71c7d0e98a2738e72fb570") + + resource( + name="fd_bank", + url="https://zenodo.org/records/7236739/files/fd_bank", + sha256="fe0f1a392cb9b6623c981de2a4fae405d9820b14e274e287e64731aede8ecb40", + expand=False, + when="@0.1.0:", + ) + resource( + name="LITHO1.0.nc", + url="https://ds.iris.edu/files/products/emc/emc-files/LITHO1.0.nc", + sha256="4429bdf3fc2a5402064b40b059faf3a79d9ce0818feb1b13122e169af56f4b43", + expand=False, + when="@0.1.0:", + ) + resource( + name="tectonicplates", + url="https://github.com/fraxen/tectonicplates/archive/339b0c56563c118307b1f4542703047f5f698fae.zip", + sha256="694ebf7090db07e47b07f1ae21175c4a5fa9c85bb79815680e439c1032407b95", + when="@0.1.0:", + ) + + depends_on("python@3.9:3.12", type=("build", "run")) + + depends_on("py-poetry-core@1:", type="build") + + depends_on("py-cartopy@0.21.1:0", type=("build", "run")) + depends_on("py-ipykernel@6.15:6", type=("build", "run")) + depends_on("py-matplotlib@3.8.3:3", type=("build", "run")) + depends_on("py-matplotlib@3.7.2:3", type=("build", "run"), when="@0.1.0") + depends_on("py-netcdf4@1.6.4:1~mpi", type=("build", "run")) + depends_on("py-numpy@1.25:1", type=("build", "run")) + depends_on("py-obspy@1.4:1", type=("build", "run")) + depends_on("py-pygmt@0.9:0.9", type=("build", "run")) + depends_on("py-pyproj@3.3:3", type=("build", "run")) + depends_on("py-scipy@1.11.1:1", type=("build", "run")) + depends_on("py-shapely@=1.7.1", type=("build", "run")) + depends_on("py-pyrocko@=2023.6.29", type=("build", "run")) + depends_on("py-typer@0.9", type=("build", "run")) + depends_on("py-okada-wrapper@=18.12.07.3", type=("build", "run")) + + # non python deps + depends_on("geos@=3.11.2", type=("build", "run")) + depends_on("gmt@=6.4.0", type=("build", "run")) + depends_on("proj@=9.2.0", type=("build", "run")) + # not a direct dep, but we do need gdal to have these variants + depends_on("gdal+jpeg+jxl+openjpeg", type=("build", "run")) + + parallel = False + + patch("fortran-filename-length.patch") + + @run_before("install") + def build(self): + # place resources, couldn't figure out another way to do this + # that didn't result in symlinks + relevant_resources = [ + resource + for resource_spec, resource_list in self.resources.items() + if self.spec.intersects(resource_spec) + for resource in resource_list + ] + for resource in relevant_resources: + res_path = resource.fetcher.stage.source_path + if resource.name == "fd_bank": + res_dst = join_path(self.build_directory, "fortran_code", "gfs_nm", "long") + elif resource.name == "LITHO1.0.nc": + res_dst = join_path(self.build_directory, "fortran_code", "info") + elif resource.name == "tectonicplates": + res_dst = self.build_directory + + res_dst = join_path(res_dst, resource.name) + + if resource.name == "tectonicplates": + copy_tree(res_path, res_dst) + else: + copy(join_path(res_path, resource.name), res_dst) + + # everything about this seems to assume it's going to reside where it's compiled + mkdirp(self.prefix) + install_tree(".", self.prefix) + + with working_dir(self.prefix.fortran_code): + with open(join_path("gfs_nm", "long", "low.in"), mode="a") as f: + f.write(f"\n{self.prefix.fortran_code.gfs_nm.long.fd_bank}") + # compile fortran code + with working_dir("bin_inversion_gfortran_f95"): + make("clean") + make() + with working_dir("bin_str_f95"): + make("clean") + make() + with working_dir("src_dc_f95"): + make("clean") + make() + + @run_after("install") + def generate_config_file(self): + file = f"""[PATHS] +code_path = {self.prefix} +surf_gf_bank = {join_path(self.prefix.fortran_code.gfs_nm.long, "low.in")} +modelling = {self.prefix.fortran_code.bin_inversion_gfortran_f95} +get_near_gf = {self.prefix.fortran_code.bin_str_f95} +compute_near_gf = {self.prefix.fortran_code.src_dc_f95} +info = {self.prefix.fortran_code.info} +cartopy_files = {self.prefix.tectonicplates}""" + + with working_dir(self.prefix): + with open("config.ini", mode="w") as f: + f.write(file) + symlink( + join_path(self.prefix, "config.ini"), + join_path( + self.prefix.lib, f"python{self.spec['python'].version.up_to(2)}", "config.ini" + ), + ) diff --git a/var/spack/repos/builtin/packages/py-obspy/package.py b/var/spack/repos/builtin/packages/py-obspy/package.py new file mode 100644 index 0000000000..318f9f8da8 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-obspy/package.py @@ -0,0 +1,36 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyObspy(PythonPackage): + """ObsPy is an open-source project dedicated to provide a Python + framework for processing seismological data""" + + homepage = "https://github.com/obspy/obspy" + pypi = "obspy/obspy-1.4.0.tar.gz" + + maintainers("snehring") + + license("LGPL-3.0-only", checked_by="snehring") + + version("1.4.1", sha256="9cf37b0ce03de43d80398703c006bfddbd709f32e8460a9404b27df998d3f747") + version("1.4.0", sha256="336a6e1d9a485732b08173cb5dc1dd720a8e53f3b54c180a62bb8ceaa5fe5c06") + + depends_on("python@3.8:3", type=("build", "run")) + + depends_on("py-setuptools", type="build") + + depends_on("py-numpy@1.20:", type=("build", "run")) + # importing hann from scipy.signal is deprecated, removed in 1.13 + # to be fixed in 1.4.1 + depends_on("py-scipy@1.7:1", type=("build", "run"), when="@1.4.1:") + depends_on("py-scipy@1.7:1.12.0", type=("build", "run"), when="@1.4.0") + depends_on("py-matplotlib@3.3:", type=("build", "run")) + depends_on("py-lxml", type=("build", "run")) + depends_on("py-sqlalchemy", type=("build", "run")) + depends_on("py-decorator", type=("build", "run")) + depends_on("py-requests", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-okada-wrapper/package.py b/var/spack/repos/builtin/packages/py-okada-wrapper/package.py new file mode 100644 index 0000000000..54f524516b --- /dev/null +++ b/var/spack/repos/builtin/packages/py-okada-wrapper/package.py @@ -0,0 +1,28 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyOkadaWrapper(PythonPackage): + """Python and MATLAB wrappers for the Okada Green's function codes""" + + homepage = "https://github.com/tbenthompson/okada_wrapper" + pypi = "okada_wrapper/okada_wrapper-18.12.07.3.tar.gz" + + maintainers("snehring") + + license("MIT", checked_by="snehring") + + version( + "18.12.07.3", sha256="ee296ad6e347c8df400f6f3d1badc371925add8d1af33854634c2fe1a2b2c855" + ) + + # https://github.com/tbenthompson/okada_wrapper/issues/8 + depends_on("python@3:3.11", type=("build", "run")) + + depends_on("py-setuptools", type="build") + + depends_on("py-numpy", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-pygmt/package.py b/var/spack/repos/builtin/packages/py-pygmt/package.py new file mode 100644 index 0000000000..a900cd043c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pygmt/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyPygmt(PythonPackage): + """A Python interface for the Generic Mapping Tools.""" + + homepage = "https://github.com/GenericMappingTools/pygmt" + pypi = "pygmt/pygmt-0.9.0.tar.gz" + + maintainers("snehring") + + license("BSD-3-Clause", checked_by="snehring") + + version("0.9.0", sha256="1090be7a3745e982af130a0289b9ceb60289b9c2c50fc2e0f681004ed7a1a20e") + + depends_on("python@3.9:3", type=("build", "run")) + + depends_on("py-setuptools@64:", type="build") + depends_on("py-setuptools-scm@6.2:", type="build") + + depends_on("py-numpy@1.21:", type=("build", "run")) + depends_on("py-pandas", type=("build", "run")) + depends_on("py-xarray", type=("build", "run")) + depends_on("py-netcdf4", type=("build", "run")) + depends_on("py-packaging", type=("build", "run")) + depends_on("gmt@6.3.0:+graphicsmagick", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-pyrocko/package.py b/var/spack/repos/builtin/packages/py-pyrocko/package.py new file mode 100644 index 0000000000..e93dbdf753 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pyrocko/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyPyrocko(PythonPackage): + """Pyrocko is an open source seismology toolbox and library, written in the + Python programming language""" + + homepage = "https://pyrocko.org/" + pypi = "pyrocko/pyrocko-2023.6.29.tar.gz" + + maintainers("snehring") + + license("GPL-3.0", checked_by="snehring") + + version("2024.1.10", sha256="4fb2c72d0b036ce3c70bfd066e1ce4946eb93d9190d202e9fc689c1f29e4845f") + version("2023.6.29", sha256="779a234592bfcfa1c96939fee53d0dfc5cadf111432a2679f08166cfd8bcae41") + + depends_on("python@3.7:", type=("build", "run")) + + depends_on("py-setuptools", type="build") + + depends_on("py-numpy@1.16:", type=("build", "run")) + depends_on("py-scipy@1:", type=("build", "run")) + depends_on("py-pyyaml", type=("build", "run")) + depends_on("py-matplotlib", type=("build", "run")) + depends_on("py-requests", type=("build", "run"))