Skip to content

Commit

Permalink
Merge pull request #127 from baagaard-usgs/update-sfbay-metadata
Browse files Browse the repository at this point in the history
Update SF-CVM information and update binary build settings
  • Loading branch information
baagaard-usgs committed Nov 10, 2021
2 parents 087ac0e + b461a3d commit 9b3b687
Show file tree
Hide file tree
Showing 41 changed files with 879 additions and 826 deletions.
3 changes: 1 addition & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Code of Conduct

All contributions to- and interactions surrounding- this project will abide by
the [USGS Code of Scientific Conduct][1].
All contributions to- and interactions surrounding- this project will abide by the [USGS Code of Scientific Conduct][1].

[1]: https://www2.usgs.gov/fsp/fsp_code_of_scientific_conduct.asp
13 changes: 3 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
Contributing
============

Contributions are welcome from the community. Questions can be asked
on the [issues page][1]. Before creating a new issue, please take a
moment to search and make sure a similar issue does not already
exist. If one does exist, you can comment (most simply even with just
a `:+1:`) to show your support for that issue.
Contributions are welcome from the community. Questions can be asked on the [issues page][1]. Before creating a new issue, please take a moment to search and make sure a similar issue does not already exist. If one does exist, you can comment (most simply even with just a `:+1:`) to show your support for that issue.

If you have direct contributions you would like considered for
incorporation into the project you can [fork this repository][2] and
[submit a pull request][3] for review.
If you have direct contributions you would like considered for incorporation into the project you can [fork this repository][2] and [submit a pull request][3] for review.

For additional information, please see the USGS software development
best practices guide[4] and the USGS Code of Scientific Conduct[5].
For additional information, please see the USGS software development best practices guide[4] and the USGS Code of Scientific Conduct[5].


[1]: https://github.com/baagaard-usgs/geomodelgrids/issues
Expand Down
9 changes: 1 addition & 8 deletions DISCLAIMER.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
## Disclaimer

This software is preliminary or provisional and is subject to revision. It is
being provided to meet the need for timely best science. The software has not
received final approval by the U.S. Geological Survey (USGS). No warranty,
expressed or implied, is made by the USGS or the U.S. Government as to the
functionality of the software and related material nor shall the fact of release
constitute any such warranty. The software is provided on the condition that
neither the USGS nor the U.S. Government shall be held liable for any damages
resulting from the authorized or unauthorized use of the software.
This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.
9 changes: 2 additions & 7 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
## License

Unless otherwise noted, this project is in the public domain in the United
States because it contains materials that originally came from the United
States Geological Survey, an agency of the United States Department of
Interior. For more information, see the official USGS copyright policy at
<https://www.usgs.gov/information-policies-and-instructions/crediting-usgs>.
Unless otherwise noted, this project is in the public domain in the United States because it contains materials that originally came from the United States Geological Survey, an agency of the United States Department of Interior. For more information, see the official USGS copyright policy at <https://www.usgs.gov/information-policies-and-instructions/crediting-usgs>.

Additionally, we waive copyright and related rights in the work
worldwide through the CC0 1.0 Universal public domain dedication.
Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication.
6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ EXTRA_DIST = \
DISCLAIMER.md \
LICENSE.md \
setup.py \
setup.cfg \
code.json \
developer/autopep8.cfg \
developer/uncrustify.cfg \
Expand All @@ -35,14 +36,15 @@ EXTRA_DIST = \
docker/debian-stable \
docker/debian-testing \
docker/ubuntu-20.04 \
docker/ubuntu-20.10 \
docker/ubuntu-21.04 \
docker/ubuntu-21.10 \
docker/fedora-33 \
docker/fedora-34 \
docker/fedora-35 \
docker/centos-8 \
docker/geomodelgrids-testenv \
docker/geomodelgrids-devenv \
docker/geomodelgrids-userenv
docker/geomodelgrids-userenv \
ci-config/run_tests.sh


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Description

Georeferenced grid-based models composed of blocks with different grid resolutions.
Georeferenced grid-based Earth models composed of blocks with different grid resolutions.

## Documentation

Expand Down
90 changes: 47 additions & 43 deletions code.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
{
"version": "2.0.0",
"measurementType": {},
"agency": "U.S. Department of Interior",
"releases": [
{
"name": "geomodelgrids",
"description": "Generate georeferenced gridded models",
"version": "v1.0.0",
"status": "??",
"organization": "U.S. Geological Survey",
"vcs": "git",
"repositoryUrl": "https://github.com/baagaard-usgs/geomodelgrids.git",
"homepageURL": "https://baagaard-usgs.github.io/geomodelgrids/",
"downloadURL": "https://github.com/baagaard-usgs/geomodelgrids/releases/tag/v1.0.0",
"disclaimerURL": "https://github.com/baagaard-usgs/geomodelgrids/blob/master/DISCLAIMER.md",
"permissions": {
"licenses": [
{
"name": "Public Domain, CC0-1.0",
"URL": "https://github.com/baagaard-usgs/geomodelgrids/blob/master/LICENSE.md"
}
],
"usageType": "openSource",
"exemptionText": null
},
"laborHours": null,
"languages": [
"Python",
"C++"
],
"tags": [
"seismic velocity model",
"HDF5",
],
"contact": {
"name": "Brad Aagaard",
"email": "baagaard@usgs.gov"
},
"date": {
"metadataLastUpdated": "2019-10-24"
[
{
"name": "geomodelgrids",
"organization": "U.S. Geological Survey",
"description": "Georeferenced grid-based Earth models composed of blocks with different grid resolutions.",
"version": "1.0.0",
"status": "Beta",

"permissions": {
"usageType": "openSource",
"licenses": [
{
"name": "Public Domain, CC0-1.0",
"URL": "https://github.com/baagaard-usgs/geomodelgrids/blob/main/LICENSE.md"
}
]
},

"homepageURL": "https://geomodelgrids.readthedocs.io",
"downloadURL": "https://github.com/baagaard-usgs/geomodelgrids/archive/main.zip",
"disclaimerURL": "https://github.com/baagaard-usgs/geomodelgrids/blob/main/LICENSE.md",
"repositoryURL": "https://github.com/baagaard-usgs/geomodelgrids.git",
"vcs": "git",

"laborHours": 0,

"tags": [
"USGS",
"U.S. Geological Survey",
"Earth model",
"seismic velocity model",
"HDF5"
],

"languages": [
"Python",
"C++"
],

"contact": {
"name": "Brad Aagaard",
"email": "baagaard@usgs.gov"
},

"date": {
"metadataLastUpdated": "2021-10-01"
}
]
}
}
]
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ----------------------------------------------------------------------

AC_PREREQ(2.59)
AC_INIT([geomodelgrids], [1.0.0rc1], [baagaard@usgs.gov])
AC_INIT([geomodelgrids], [1.0.0rc2], [baagaard@usgs.gov])
AC_CONFIG_HEADER([portinfo])
AC_CONFIG_AUX_DIR([./aux-config])
AC_CONFIG_MACRO_DIR([m4])
Expand Down
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Docker images

```
```console
# Run in top-level source directory
bash> docker build -t $TAG -f docker/$FILE .
docker build -t $TAG -f docker/$FILE .
```

```
bash> docker run --rm -it -v $TOOLS_DIR/earthvision-11:/opt/earthvision -v $HOME/data/cencal-geology:/data/cencal-geology baagaard/earthvision-env /bin/bash
docker run --rm -it -v $TOOLS_DIR/earthvision-11:/opt/earthvision -v $HOME/data/cencal-geology:/data/cencal-geology baagaard/earthvision-env /bin/bash
```
10 changes: 5 additions & 5 deletions docker/build_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
2. Install geomodelgrids
3. Create setup.sh
4. Update linking (Darwin only)
4. Create tarball.
5. Create tarball.
"""

import argparse
Expand Down Expand Up @@ -185,7 +185,7 @@ def configure(self):

# --------------------------------------------------------------------------------------------------
class OpenSSL(Package):
VERSION = "1.1.1k"
VERSION = "1.1.1l"
TARBALL = f"openssl-{VERSION}.tar.gz"
URL = f"https://www.openssl.org/source/{TARBALL}"
SRC_DIR = f"openssl-{VERSION}"
Expand Down Expand Up @@ -222,7 +222,7 @@ def configure(self):

# --------------------------------------------------------------------------------------------------
class Proj(Package):
VERSION = "7.2.1"
VERSION = "8.1.1"
TARBALL = f"proj-{VERSION}.tar.gz"
URL = f"https://download.osgeo.org/proj/{TARBALL}"
BUILD_DIR = "proj-build"
Expand All @@ -248,9 +248,9 @@ def install(self):

# --------------------------------------------------------------------------------------------------
class HDF5(Package):
VERSION = "1.12.0"
VERSION = "1.12.1"
TARBALL = f"hdf5-{VERSION}.tar.gz"
URL = f"https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_12_0/source/{TARBALL}"
URL = f"https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-{VERSION}/src/{TARBALL}"
BUILD_DIR = "hdf5-build"
SRC_DIR = f"hdf5-{VERSION}"

Expand Down
15 changes: 8 additions & 7 deletions docker/linux-binary
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ RUN yum install -y rh-python38

COPY docker/certs/ /usr/share/pki/ca-trust-source/anchors
RUN update-ca-trust enable
ENV CERT_PATH=/etc/ssl/certs CERT_FILE=ca-bundle.crt

# ------------------------------------------------------------------------------
from os-update as build-setup
Expand All @@ -39,15 +40,13 @@ ENV INSTALL_DIR=$STORAGE_DIR/dest HOME=/home/$GMG_USER

RUN mkdir ${STORAGE_DIR} \
&& chown ${GMG_USER} ${STORAGE_DIR} \
&& chgrp ${GMG_USER} ${STORAGE_DIR}
&& chgrp ${GMG_USER} ${STORAGE_DIR} \
&& mkdir ${STORAGE_DIR}/build
USER ${GMG_USER}

RUN mkdir -p ~/.config/pip \
&& echo "[global]" > $HOME/.config/pip/pip.conf \
&& echo "trusted-host = pypi.org files.pythonhosted.org" >> $HOME/.config/pip/pip.conf \
&& scl enable rh-python38 -- python3 -m pip install requests --user
RUN scl enable rh-python38 -- python3 -m pip install requests --user

WORKDIR $STORAGE_DIR
WORKDIR $STORAGE_DIR/build

# To build up to here:
# docker build -t geomodelgrids-binaryenv -f docker/linux-binary --target build-setup .
Expand All @@ -56,11 +55,13 @@ WORKDIR $STORAGE_DIR
# docker run -ti --rm --name geomodelgrids-binary-workspace -v geomodelgrids-binary:/opt/geomodelgrids geomodelgrids-binaryenv
# docker cp TARBALL geomodelgrids-binary-workspace:/opt/geomodelgrids/build
# docker cp docker/build_binary.py geomodelgrids-binary-workspace:/opt/geomodelgrids/build
# svn enable rh-python38 -- /opt/geomodelgrids/src/docker/build_binary.py --install-dir=$INSTALL_DIR --version=X.X.X --all
# export SSL_CERT_PATH=/etc/ssl/certs/ca-bundle.crt REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-bundle.crt
# scl enable rh-python38 -- /opt/geomodelgrids/src/docker/build_binary.py --install-dir=$INSTALL_DIR --version=X.X.X --all

# ------------------------------------------------------------------------------
from build-setup as build-binary

ENV BUILD_DIR=${STORAGE_DIR}/build
COPY --chown=gmg-user:gmg-user docker/build_binary.py ${BUILD_DIR}

WORKDIR $BUILD_DIR
Expand Down
9 changes: 5 additions & 4 deletions geomodelgrids/create/apps/create_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ def main(self, **kwargs):
self.show_parameters()
return

data_path = self.config["geomodelgrids"]["data_source"].split(".")
data_obj = getattr(import_module(".".join(data_path[:-1])), data_path[-1])
datasrc = data_obj(self.config)
datasrc.initialize()
if args.import_domain or args.import_surfaces or args.all:
data_path = self.config["geomodelgrids"]["data_source"].split(".")
data_obj = getattr(import_module(".".join(data_path[:-1])), data_path[-1])
datasrc = data_obj(self.config)
datasrc.initialize()
model = core.model.Model(self.config)

if args.import_domain or args.all:
Expand Down
7 changes: 4 additions & 3 deletions geomodelgrids/create/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def get_attributes(self):
return attrs


@ dataclass
@dataclass
class ModelMetadata:
"""Metadata describing model.
"""
Expand Down Expand Up @@ -506,8 +506,9 @@ def __init__(self, config):
self.dim_z = float(config["domain"]["dim_z"])

# Auxiliary data
if "auxiliary" in config:
self.auxiliary = config["auxiliary"]
if "auxiliary" in config["data"]:
import json
self.auxiliary = json.loads(config["data"]["auxiliary"])
else:
self.auxiliary = {}

Expand Down
43 changes: 21 additions & 22 deletions libsrc/geomodelgrids/serial/Query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,28 +196,27 @@ geomodelgrids::serial::Query::query(double* const values,
bool found = false;
for (size_t i = 0; i < _models.size(); ++i) {
assert(_models[i]);
if (_models[i]->contains(x, y, z)) {
double elevationSquash = z;
switch (_squash) {
case SQUASH_NONE:
break;
case SQUASH_TOP_SURFACE:
if (z > _squashMinElev) {
const double topElev = _models[i]->queryTopElevation(x, y);
elevationSquash = z + topElev;
} // if
break;
case SQUASH_TOPOGRAPHY_BATHYMETRY:
if (z > _squashMinElev) {
const double groundElev = _models[i]->queryTopoBathyElevation(x, y);
elevationSquash = z + groundElev;
} // if
break;
default:
throw std::logic_error("Unknown squashing type.");
} // switch

const double* modelValues = _models[i]->query(x, y, elevationSquash);
double zSquash = z;
switch (_squash) {
case SQUASH_NONE:
break;
case SQUASH_TOP_SURFACE:
if (z > _squashMinElev) {
const double topElev = _models[i]->queryTopElevation(x, y);
zSquash = z + topElev;
} // if
break;
case SQUASH_TOPOGRAPHY_BATHYMETRY:
if (z > _squashMinElev) {
const double groundElev = _models[i]->queryTopoBathyElevation(x, y);
zSquash = z + groundElev;
} // if
break;
default:
throw std::logic_error("Unknown squashing type.");
} // switch
if (_models[i]->contains(x, y, zSquash)) {
const double* modelValues = _models[i]->query(x, y, zSquash);
values_map_type& modelMap = _valuesIndex[i];
for (size_t iValue = 0; iValue < numQueryValues; ++iValue) {
values[iValue] = modelValues[modelMap[iValue]];
Expand Down

0 comments on commit 9b3b687

Please sign in to comment.