cibor

Codes for inverting subsurface temperature profiles

https://github.com/cuestavalero/cibor

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Codes for inverting subsurface temperature profiles

Basic Info
  • Host: GitHub
  • Owner: cuestavalero
  • License: mit
  • Language: Fortran
  • Default Branch: master
  • Size: 79.1 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Created almost 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation

README.md

CIBOR

The Codes for Inverting BOReholes (CIBOR) are a collection of scripts to perform Singular Value Decomposition (SVD) inversions of subsurface temperature profiles with different strategies to aggregate results from any number of profiles.

All estimates retrieved by this suite solves the inversion problem: given the final measured subsurface temperature profile, CIBOR estimates the past changes in surface temperatures generating the observed profile. To this end, the code solves a system of equations using a Singular Value Decomposition (SVD) algorithm. Then, three different methods can be used to estimate uncertainties in the inversions and to aggregate results from different profiles to estimate regional and global means. Please, check Cuesta-Valero et al. (2022) for a detailed comparision of CIBOR methods.

CIBOR has been tested using the gfortran 9.4.0 compiler and OpenMP 4.5 libraries. The test scripts were executed using python 3.8.10 on a laptop with Ubuntu 20.04.4 LTS.


Test

The CIBOR suite includes a test for each of its three mthods: Singular Value Decomposition inversion (SVD, Beltrami et al., 2015), Perturbed Parameter Inversion (PPI, Cuesta-Valero et al., 2021), and Bootstrap Inversions (BTI, Cuesta-Valero et al., 2022).

Each test produce the inversion of the subsurface temperature profile located in data/. Just set the corresponding flag to True in the script run_tests.py to obtain the inversion of the test profile. If you want to plot the results, set the plots flag to True in the same script.

You can execute the tests using a python3 compiler:

``` python3 run_tests.py

```

The test will generate different files depending on your choice of flags:

  1. A pdf file containing a plot of the inversions performed with the selected methods, if the flag plots was activated in the python script.

  2. Some dat files containing the inversion of the profile located in data using the selcted methods.

SVD Results

The dat file containing the SVD inversion includes several fields denoted by several keywords starting with the character #:

  • #z1: Minimum depth used to estimate the quasi-equilibrium temperature profile (m).

  • #z2: Maximum depth used to estimate the quasi-equilibrium temperature profile (m).

  • #t0: Estimated long-term surface temperature climatology and associated error (one sigma) (Celsius).

  • #gamma: Estimated long-term geothermal gradient and associated error (one sigma) (C m-1).

  • #n: Number of temperature records used to estimate the quasi-equilibrium temperature profile.

  • #r2: R2 coefficient for the linear regression analysis performed to estimate the quasi-equilibrium temperature profile.

  • #pvalue: P-Value for the linear regression analysis performed to estimate the quasi-equilibrium temperature profile.

  • #o: Depth (first column, m) and temperature (second column, C) of the original profile.

  • #a: The three anomaly profiles derived for the analysis. Depth (first column, m), extremal anomaly profiles (second and fourth columns, C), and best estimate for the anomaly profile (third column, C).

  • #g: Ground surface temperature history estimated from the profile. Year (first column), extremal histories (second and fourth columns, C) and best estimate for the temperature history (third column, C).

  • #f: Anomaly profiles generated by driving a conductive forward model with the three groud surface temperature histories retrieved from the profile. Depth (first column, m), extremal anomaly profiles (second and fourth columns, C) and best estimate of the anomaly profile (third column, C). This anomaly profiles can be directly compared with the anomaly profiles from the original log to evaluate the performance of the inversion.

PPI Results

The dat file containing the PPI inversion includes several fields denoted by several keywords starting with the character #:

  • #tol: Tolerance for consecutive temperature change in the retrieved temperature histories.

  • #err: Measurement error assumed for the profile.

  • #wmin: Minimum eigenvalue considered.

  • #wmax: Maximum eigenvalue considered.

  • #z1: Minimum depth used to estimate the quasi-equilibrium temperature profile (m).

  • #z2: Maximum depth used to estimate the quasi-equilibrium temperature profile (m).

  • #t0: Estimated long-term surface temperature climatology and associated error (one sigma) (Celsius).

  • #gamma: Estimated long-term geothermal gradient and associated error (one sigma) (C m-1).

  • #n: Number of temperature records used to estimate the quasi-equilibrium temperature profile.

  • #r2: R2 coefficient for the linear regression analysis performed to estimate the quasi-equilibrium temperature profile.

  • #pvalue: P-Value for the linear regression analysis performed to estimate the quasi-equilibrium temperature profile.

  • #o: Depth (first column, m) and temperature (second column, C) of the original profile.

  • #a: The three anomaly profiles derived for the analysis. Depth (first column, m), extremal anomaly profiles (second and fourth columns, C), and best estimate for the anomaly profile (third column, C).

  • #k: Thermal diffusivity (first column, m2 s-1), eigenvalue (second column), weight (third column), ensemble id (fourth column), and type (fifth column) for each one of the individual inversions considered in the ensemble. The inversion type indicates if the inverted anomaly profile was and extremal one (p or m) or the best estimate (o).

  • #g: Ground surface temperature history estimated from the profile. Year (first column), extremal histories (second and fourth columns, C) and best estimate for the temperature history (third column, C).

  • #f: Anomaly profiles generated by driving a conductive forward model with the three groud surface temperature histories retrieved from the profile. Depth (first column, m), extremal anomaly profiles (second and fourth columns, C) and best estimate of the anomaly profile (third column, C). This anomaly profiles can be directly compared with the anomaly profiles from the original log to evaluate the performance of the inversion.

BTI Results

The dat file containing the BTI inversion includes several fields denoted by several keywords starting with the character #:

  • #n_total: Number of bootstrap samplings to generate the inversion.

  • #nthreads: Number of parallel threads used.

  • #n_original_logs: Number of logs aggregated.

  • #max_year: Higher year with data.

  • #min_year: Minimum year with data.

  • #az1: Minimum depth used to estimate the quasi-equilibrium temperature profile (m).

  • #az2: Maximum depth used to estimate the quasi-equilibrium temperature profile (m).

  • #tseries: Time steps, in years before present, used to retrieve the surface histories.

  • #gtemp: Ground surface temperature history estimated from the profile. Year (first column), 2.5th percentile (second column, C), best estimate for the temperature history (third column, C), 97.5th percentile (fourth column, C), number of bootstrap samplings (fifth column), number of logs (sixth column).

  • #ftemp: Anomaly profile generated by driving a conductive forward model with the inversions performed to estimate the ground surface temperature history. Depth (first column, m), 2.5th percentile of all forward models (second column, C), best estimate of the anomaly profile (third column, C), and 97.5th percentile of all forward models (fourth column, C). This anomaly profiles can be directly compared with the anomaly profiles from the original log to evaluate the performance of the inversion.


Reading Inversion Results

Bash

Reading and extracting relevant fields denoted with the character # with bash is as easy as executing the following code in a terminal:

sh cat inversion_file.dat | grep -w "#field" | awk 'for (i=2;i<=NF;i++) printf $i " "; print ""}'> final_file.dat

Python

Extracting the values of a certain filed denoted with a # character in python is also simple. For example, if you are interested in the retrieved goundsurface temperature history from the bootstrap inversion, you can add to your script the following code:

```python data=open('file.dat') data = data.readlines() temp1 = [] temp2 = [] temp3 = [] time = [] for i in range(len(data)): row=data[i].split() if len(row) > 0: if row[0] == '#gtemp': time.append(float(row[0])) temp1.append(float(row[1])) temp2.append(float(row[2])) temp3.append(float(row[3]))

```

Julia

Similarly to python, if you want to read the ground surface temperature history from the bootstrap inversion to be used in a julia script, you just need to add to your julia script the following code:

julia using DelimitedFiles run(pipeline(`grep -w "gtemp" file.dat`, "final_file.dat")) data = readdlm("final_file.dat")


Versions

Version 0.0.0 - June 2022

Version 0.1.0 - August 2022

Version 0.1.1 - August 2022

Version 0.1.2 - August 2022

Version 1.0.0 - October 2022


License

This project is licensed under the MIT License. See also the LICENSE file.


How to Cite

Please, cite this code as:

bibtex @article{cuesta-valero2022cibor100, author = {Cuesta-Valero, F. J. and Beltrami, H. and Gruber, S. and Garc\'{\i}a-Garc\'{\i}a, A. and Gonz\'{a}lez-Rouco, J. F.}, journal = {Geoscientific Model Development Discussions}, title = {A new bootstrap technique to quantify uncertainty in estimates of ground surface temperature and ground heat flux histories from geothermal data}, year = {2022}, pages = {1--32}, volume = {2022}, doi = {10.5194/gmd-2022-178}, url = {https://gmd.copernicus.org/preprints/gmd-2022-178/},

In case the citation is not for a scientific publication:

bibtex @software{cibor100, author = {Cuesta-Valero, Francisco Jose}, doi = {10.5281/zenodo.1234}, title = {{CIBOR}: {C}odes for {I}nverting {BOR}eholes}, url = {https://github.com/cuestavalero/CIBOR}, version = {1.0.0}, year = {2022}, month = {10}, }


References

  • Beltrami H., Matharoo G.S., and Smerdon J.E.: Ground surface temperature and continental heat gain: uncertainties from underground. Environmental Research Letters, 10, 014009, doi:10.1088/1748-9326/10/1/014009, 2015.

  • Cuesta-Valero, F. J., Beltrami, H., Gruber, S., Garcı́a-Garcı́a, A. & González-Rouco, J. F.: A new bootstrap technique to quantify uncertainty in estimates of ground surface temperature and ground heat flux histories from geothermal data. Geoscientific Model Development, doi:10.5194/gmd-2022-178, 2022.

  • Cuesta-Valero F.J., García-García A., Beltrami H., González-Rouco J.F., and García-Bustamante E.: Long-term global ground heat flux and continental heat storage from geothermal data. Climate of the Past, 17, 451-468, doi:10.5194/cp-17-451-2021, 2021.

Owner

  • Name: Francisco José Cuesta-Valero
  • Login: cuestavalero
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "Cuesta-Valero"
    given-names: "Francisco Jose"
    orcid: "https://orcid.org/0000-0003-1577-671X"
title: "CIBOR: Codes for Inverting BOReholes"
version: 1.0.0
doi: 10.5281/zenodo.7017521
date-released: 2022-10-06
url: "https://github.com/cuestavalero/CIBOR"

GitHub Events

Total
Last Year