Skip to content
Snippets Groups Projects

Production Release | nshmp-haz

Merged Clayton, Brandon Scott requested to merge main into production
7 files
+ 435
393
Compare changes
  • Side-by-side
  • Inline
Files
7
+ 42
7
@@ -15,9 +15,18 @@ ext {
nshmDir = "nshms";
// Download and unzip NSHM
downloadNshm = {repo, tag, year ->
downloadNshm = {nshm ->
def repo = nshm.repo
def tag = nshm.tag
def year = nshm.year
def zipName = "${repo}-${tag}.zip";
def zipFile = new File(nshmDir, zipName)
def nshmFile = file("${nshmDir}/${repo}-${year}")
if (nshmFile.exists()) {
delete nshmFile
}
download.run {
src "https://code.usgs.gov/ghsc/nshmp/nshms/${repo}/-/archive/${tag}/${zipName}"
@@ -27,11 +36,25 @@ ext {
from zipTree(zipFile)
into nshmDir
}
file("${nshmDir}/${repo}-${tag}").renameTo(file("${nshmDir}/${repo}-${year}"))
file("${nshmDir}/${repo}-${tag}").renameTo(nshmFile)
delete {
delete zipFile
}
}
// Returns a NSHM from nshms.yml array
findNshm = {repo, year ->
def yaml = new Yaml()
def nshmConfig = new Yaml().load(new File("${projectDir}/nshms.yml").newInputStream())
def nshm = nshmConfig.nshms.find{nshm -> nshm.repo == repo && nshm.year == year}
if (nshm == null) {
throw new Exception("NSHM ${repo} ${year} not found.")
}
return nshm
}
}
task cleanNshm(type: Delete) {
@@ -48,7 +71,7 @@ task nshms() {
doLast {
for (nshm in nshmConfig.nshms) {
// Download NSHM
downloadNshm(nshm.repo, nshm.tag, nshm.year)
downloadNshm(nshm)
}
}
}
@@ -57,7 +80,10 @@ task nshms() {
task testAlaska2023(type: Test) {
description = "Test Alaska 2023 NSHM"
group = "verification"
dependsOn nshms
doFirst {
downloadNshm(findNshm("nshm-alaska", 2023))
}
testLogging {
exceptionFormat "full"
@@ -78,7 +104,10 @@ task testAlaska2023(type: Test) {
task testConus2018(type: Test) {
description = "Test CONUS 2018 NSHM"
group = "verification"
dependsOn nshms
doFirst {
downloadNshm(findNshm("nshm-conus", 2018))
}
testLogging {
exceptionFormat "full"
@@ -99,7 +128,10 @@ task testConus2018(type: Test) {
task testConus2023(type: Test) {
description = "Test CONUS 2023 NSHM"
group = "verification"
dependsOn nshms
doFirst {
downloadNshm(findNshm("nshm-conus", 2023))
}
testLogging {
exceptionFormat "full"
@@ -120,7 +152,10 @@ task testConus2023(type: Test) {
task testHawaii2021(type: Test) {
description = "Test Hawaii 2021 NSHM"
group = "verification"
dependsOn nshms
doFirst {
downloadNshm(findNshm("nshm-hawaii", 2021))
}
testLogging {
exceptionFormat "full"
Loading