diff --git a/README.md b/README.md index 89749954cdc8f9a0c7f32c8af72f9918c09ba189..44ebc8307d896b325ac289f9704a4f57e6fa3e57 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # GeoPhys  -This set of utilities is used to extract geophysical information from the NCM (Boyd, 2020) -including, for example, S-wave, P-wave, and density profiles, as well as attributes for ground -motions models including *V*S30, *Z*1.0, and *Z*2.5. Running the code in either MATLAB or + +This set of utilities is used to extract geophysical information from the NCM (Boyd, 2020) +including, for example, S-wave, P-wave, and density profiles, as well as attributes for ground +motions models including *V*S30, *Z*1.0, and *Z*2.5. Running the code in either MATLAB or Python requires all of the NCM databases: [GeoPhys](https://code.usgs.gov/ghsc/nshmp/ncm/GeoPhys) -* NCM_AuxData.nc (https://doi.org/10.5066/P9GO3CP8) + +* NCM_AuxData.nc (<https://doi.org/10.5066/P9GO3CP8>) [GeoFram](https://code.usgs.gov/ghsc/nshmp/ncm/GeoFram) @@ -21,19 +23,23 @@ Python requires all of the NCM databases: * MineralPhysicsDatabase.nc -These codes are part of an effort to produce a three dimensional national crustal model for use with seismic hazard studies. (https://doi.org/10.5066/P9T96Q67) +These codes are part of an effort to produce a three dimensional national crustal model for use with seismic hazard studies. (<https://doi.org/10.5066/P9T96Q67>) ## Python + See the [README](geophys/README.md) file in the [geophys](geophys) directory for instructions on installing the database and running in Python. ## Matlab + See the [README](matlab/README.md) file in the [matlab](matlab) directory for running in MATLAB. ## Help + Any questions regarding the code can be directed to olboyd@usgs.gov. ## References + *Boyd, O.S., 2020, Calibration of the U.S. Geological Survey National Crustal Model: U.S. Geological Survey Open-File -Report 2020–1052, 23 p., https://doi.org/10.3133/ofr20201052* +Report 2020–1052, 23 p., <https://doi.org/10.3133/ofr20201052>* diff --git a/geophys/README.md b/geophys/README.md index 9c2514f14c571b869e3b508168bc863cb117e721..2ec8a2412213ffacd9de6e3b6aba57daeb173fce 100644 --- a/geophys/README.md +++ b/geophys/README.md @@ -1,5 +1,6 @@ # GeoPhys Python routines  -This set of utilities is used to extract geophysical profiles from the NCM (Boyd, 2020). Running the code requires the NCM Calibration dataset (https://doi.org/10.5066/P9GO3CP8), NCM Geologic Framework databases (https://doi.org/10.5066/P9SBQENM), NCM thermal model, NCM_TemperatureGrids.nc (https://doi.org/10.5066/P935DT1G), and the NCM Petrologic and Mineral Physics database (https://doi.org/10.5066/P9HN170G). These codes and datasets are part of an effort to produce a three dimensional national crustal model for use with seismic hazard studies. (https://doi.org/10.5066/P9T96Q67) + +This set of utilities is used to extract geophysical profiles from the NCM (Boyd, 2020). Running the code requires the NCM Calibration dataset (<https://doi.org/10.5066/P9GO3CP8>), NCM Geologic Framework databases (<https://doi.org/10.5066/P9SBQENM>), NCM thermal model, NCM_TemperatureGrids.nc (<https://doi.org/10.5066/P935DT1G>), and the NCM Petrologic and Mineral Physics database (<https://doi.org/10.5066/P9HN170G>). These codes and datasets are part of an effort to produce a three dimensional national crustal model for use with seismic hazard studies. (<https://doi.org/10.5066/P9T96Q67>) Profiles can be returned from roughly -126 degrees to -100 degrees longitude and 22 to 53 degrees latitude. If the requested location is outside of the bounds of the NCM, a message to that effect will be returned. @@ -9,19 +10,23 @@ Profiles can be returned from roughly -126 degrees to -100 degrees longitude and * [Poetry](https://python-poetry.org/) Python dependency manager ### Poetry Install + See [Poetry installation](https://python-poetry.org/docs/) instructions for more. #### osx / linux / bashonwindows install instructions + ```bash curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python ``` #### windows powershell install instructions + ```bash (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python ``` #### pip + ```bash pip install --user poetry ``` @@ -29,22 +34,27 @@ pip install --user poetry ## Usage ### Install Dependenices + ```bash poetry install ``` ### Install GeoPhys Database + The following will install the GeoPhys database only: + ```bash poetry run database --GeoPhys ``` To download all databases: + ```bash poetry run database ``` The output directory for the database can be specified using the `--output` argument: + ```bash poetry run database --output="/path/to/database" @@ -52,8 +62,9 @@ poetry run database --output="/path/to/database" poetry run database --output="~/NCM_DATA" ``` -The output directory can additionally be specified using the environmental variable +The output directory can additionally be specified using the environmental variable `NCM_DATABASE_PATH`: + ```bash export NCM_DATABASE_PATH="/path/to/database" @@ -62,13 +73,16 @@ export NCM_DATABASE_PATH="~/NCM_DATA" ``` ### Remove Database + To remove database directory: + ```bash poetry run database --clean ``` ### Examples -Geophysical profile at a latitude and longitude of 36, -118 from the + +Geophysical profile at a latitude and longitude of 36, -118 from the surface to 30 m depth in increments of 1 m. ```bash @@ -82,6 +96,7 @@ poetry run geophys -f geophys/resources/example.Input ``` ### Help + Please see or query the code for help. ```bash @@ -90,32 +105,39 @@ poetry run help Any questions regarding the code and data can be directed to olboyd@usgs.gov. -# Development +## Development ### Git Hooks + The GeoPhys project contains githooks on pre-commit and pre-push that will check the Python code format using [Black](https://github.com/psf/black), -check the import sorting using [isort](https://github.com/timothycrosley/isort), and +check the import sorting using [isort](https://github.com/timothycrosley/isort), and lints the code using [Flake8](https://gitlab.com/pycqa/flake8). The GitHooks are configured with: -``` + +```bash poetry run setup ``` ### Checking the Format + To check the format of the code against Black and isort run: -``` + +```bash poetry run format_check ``` ### Formatting the Code + To automatically format the code using Black and isort run: + ```bash poetry run format ``` ## References + *Boyd, O.S., 2020, Calibration of the U.S. Geological Survey National Crustal Model: U.S. Geological Survey Open-File -Report 2020–1052, 23 p., https://doi.org/10.3133/ofr20201052* +Report 2020–1052, 23 p., <https://doi.org/10.3133/ofr20201052>* diff --git a/matlab/README.md b/matlab/README.md index eda9b7539ba4058206ab53daf99271846ee314f4..52fcd5fccd25fac51beee31cd022ef677c09e756 100644 --- a/matlab/README.md +++ b/matlab/README.md @@ -1,15 +1,19 @@ # GeoPhys MATLAB routines  -This program is used to extract geophysical profiles from the NCM (Boyd, 2020). Running the code requires the NCM Calibration dataset (https://doi.org/10.5066/P9GO3CP8), NCM Geologic Framework databases (https://doi.org/10.5066/P9SBQENM), NCM thermal model, NCM_TemperatureGrids.nc (https://doi.org/10.5066/P935DT1G), and the NCM Petrologic and Mineral Physics database (https://doi.org/10.5066/P9HN170G). These codes and datasets are part of an effort to produce a three dimensional national crustal model for use with seismic hazard studies. (https://doi.org/10.5066/P9T96Q67) + +This program is used to extract geophysical profiles from the NCM (Boyd, 2020). Running the code requires the NCM Calibration dataset (<https://doi.org/10.5066/P9GO3CP8>), NCM Geologic Framework databases (<https://doi.org/10.5066/P9SBQENM>), NCM thermal model, NCM_TemperatureGrids.nc (<https://doi.org/10.5066/P935DT1G>), and the NCM Petrologic and Mineral Physics database (<https://doi.org/10.5066/P9HN170G>). These codes and datasets are part of an effort to produce a three dimensional national crustal model for use with seismic hazard studies. (<https://doi.org/10.5066/P9T96Q67>) Profiles can be returned from roughly -126 degrees to -100 degrees longitude and 22 to 53 degrees latitude. If the requested location is outside of the bounds of the NCM, a message to that effect will be returned. ## Installation + Within matlab, add to your path the location of the GeoPhys matlab scripts. The LoadNCMData.m script assumes that the databases (mentioned above) are installed in NCMBase/database where NCMBase is ../../(Location of LoadNCMData.m). For example, GeoPhys.m might be located in Path/NCM/GeoPhys/matlab. The database directory would then be in Path/NCM/database. LoadNCMData.m can be edited to allow for a different location of the database. ## Example + See example.m for an example. ## Help + Please see or query the code for help. **matlab>> help GeoPhys** @@ -17,6 +21,7 @@ Please see or query the code for help. Any questions regarding the code and data can be directed to olboyd@usgs.gov. ## References + *Boyd, O.S., 2020, Calibration of the U.S. Geological Survey National Crustal Model: U.S. Geological Survey Open-File -Report 2020–1052, 23 p., https://doi.org/10.3133/ofr20201052* +Report 2020–1052, 23 p., <https://doi.org/10.3133/ofr20201052>*