{"id":19665565,"url":"https://github.com/fatiando/transform21","last_synced_at":"2025-06-21T10:42:15.675Z","repository":{"id":52610414,"uuid":"347964438","full_name":"fatiando/transform21","owner":"fatiando","description":"Material for the Harmonica tutorial at Transform21","archived":false,"fork":false,"pushed_at":"2021-08-10T21:12:30.000Z","size":11580,"stargazers_count":11,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T11:34:13.837Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fatiando.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-15T12:40:45.000Z","updated_at":"2024-12-19T07:33:15.000Z","dependencies_parsed_at":"2022-09-02T18:31:20.315Z","dependency_job_id":null,"html_url":"https://github.com/fatiando/transform21","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatiando%2Ftransform21","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatiando%2Ftransform21/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatiando%2Ftransform21/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatiando%2Ftransform21/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fatiando","download_url":"https://codeload.github.com/fatiando/transform21/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397577,"owners_count":21583034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T16:23:27.376Z","updated_at":"2025-04-28T22:31:14.537Z","avatar_url":"https://github.com/fatiando.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Processing gravity data with Harmonica\n\nThe [Harmonica tutorial at Transform 21](http://schedule.softwareunderground.org/) 💚\n\nInstructors:\n[Santiago Soler](https://santisoler.github.io)\u003csup\u003e1,2\u003c/sup\u003e,\n[Andrea Balza Morales](https://www.andreabalza.com/)\u003csup\u003e3\u003c/sup\u003e and\n[Agustina Pesce](https://aguspesce.github.io/)\u003csup\u003e1,2\u003c/sup\u003e\n\n\u003e \u003csup\u003e1\u003c/sup\u003e CONICET, Argentina\n\u003e \u003cbr\u003e\n\u003e \u003csup\u003e2\u003c/sup\u003e Instituto Geofísico Sismológico Volponi, UNSJ, Argentina\n\u003e \u003cbr\u003e\n\u003e \u003csup\u003e3\u003c/sup\u003e RWTH Aachen, Applied Geophysics and Geothermal Energy, Germany\n\n\n|         | Info |\n|--------:|:-----|\n| When | Thursday, April 22 • 17:00 - 19:00 GMT |\n| Slack (Q\u0026A) | [Software Underground](https://softwareunderground.org/) channel `t21-thurs-harmonica` |\n| Live stream | https://youtu.be/0bxZcCAr6bw |\n| conda environment  | `t21-thurs-harmonica` |\n| Harmonica documentation | https://www.fatiando.org/harmonica |\n\n\n## BEFORE THE TUTORIAL\n\nMake sure you've done these things **before the tutorial on Thursday**:\n\n1. Sign-up for the [Software Underground Slack](https://softwareunderground.org/slack)\n1. Join the channel `t21-thurs-harmonica`. This is where **all communication will\n   happen**.\n1. Set up your computer ([instructions below](#setup)). We will not have time to\n   solve many computer issues during the tutorial so make sure you do this\n   ahead of time. If you need any help, ask at the `t21-thurs-harmonica` channel on\n   Slack.\n\n## About\n\nIn this tutorial we’ll take a tour around\n[Harmonica](https://www.fatiando.org/harmonica), a Python library for forward\nmodelling, inversion and processing gravity data, focusing on the processing\nworkflow. We will start with a real dataset of scattered gravity observations\nand finally produce a regular grid of the Bouguer gravity disturbance. We will\naccomplish this by following these steps:\n\n- Load the gravity dataset.\n- Compute **gravity disturbance** by removing the **normal gravity** through\n  **Boule**.\n- **Project** the data to plain coordinates.\n- Load a digital elevation model (DEM) of the survey area.\n- Compute **Bouguer gravity disturbance** by forward modelling the\n  **topography** with **prisms**.\n- **Interpolate** the Bouguer gravity disturbance onto a **regular grid** at\n  a constant height through the equivalent layer technique.\n- Obtain the Bouguer gravity disturbance on a **profile** using the same\n  **equivalent layer**.\n\n\n## Prerequisites\n\n* Some knowledge of Python is assumed (for example, you might want to attend\n  [this](https://transform2020.sched.com/event/c7Jm/getting-started-with-python) or\n  [this](https://transform2020.sched.com/event/c7Jn/more-python-for-subsurface) tutorial).\n* All coding will be done in Jupyter notebooks. I'll explain how they work\n  briefly but it will help if you've used them before.\n* We'll use [numpy](https://numpy.org/), [pandas](https://pandas.pydata.org/),\n  [xarray](http://xarray.pydata.org/), and [matplotlib](https://matplotlib.org/).\n  You don't need to be an expert in these tools but some familiarity will help.\n\n\n## Setup\n\nThere are a few things you'll need to follow the tutorial:\n\n1. A working Python installation ([Anaconda](https://www.anaconda.com/) or Miniconda)\n2. The Harmonica tutorial *conda environment* installed\n3. A web browser that works with Jupyter notebooks\n   (basically anything except Internet Explorer)\n\nTo get things setup, please do the following.\n\n**If you have any trouble**, please ask for help in the\n`t21-thurs-harmonica` channel on the Software Underground slack.\n\n**Windows users:** When you see \"*terminal*\" in the instructions,\nthis means the \"*Anaconda Prompt*\" program for you.\n\n### Step 1\n\n**Install a Python distribution:**\n\nIn this tutorial we will be using the [Anaconda](https://www.anaconda.com/)\nPython distribution along with the `conda` package manager. If you already have\nAnaconda or Miniconda installed, you can skip this step.\n\nIf not, please follow the instructions for getting Anaconda up and running in\nyour system: https://docs.anaconda.com/anaconda/install/\n\n### Step 2\n\n**Create the `t21-thurs-harmonica` conda environment:**\n\n1. Download the `environment.yml` file from\n   [here](https://raw.githubusercontent.com/fatiando/transform21/master/environment.yml)\n   (right-click and select \"Save page as\" or similar)\n1. Make sure that the file is called `environment.yml`. Windows sometimes adds a\n   `.txt` to the end, which you should remove.\n1. Open a terminal (*Anaconda Prompt* if you are running Windows). The\n   following steps should be done in the terminal.\n1. Navigate to the folder that has the downloaded environment file\n   (if you don't know how to do this, take a moment to read [the Software\n   Carpentry lesson on the Unix shell](http://swcarpentry.github.io/shell-novice/)).\n1. Create the conda environment by running `conda env create --file environment.yml`\n   (this will download and install all of the packages used in the tutorial).\n\n### Step 3\n\n**Verify that the installation works:**\n\n1. Download the `test_install.py` script from\n   [here](https://raw.githubusercontent.com/fatiando/transform21/master/test_install.py)\n1. Open a terminal. The following steps should be done in the terminal.\n1. Activate the environment: `conda activate t21-thurs-harmonica`\n1. Navigate to the folder where you downloaded `test_install.py`\n1. Run the test script: `python test_install.py`\n1. You should this text in the terminal (the last part of the second line will depend on your system):\n   ```\n   Harmonica version: 0.2.1\n   Downloading file 'south-africa-gravity.ast.xz' from 'https://github.com/fatiando/harmonica/raw/v0.2.0/data/south-africa-gravity.ast.xz' to '/home/USER/.cache/harmonica/v0.2.0'.\n   ```\n1. The following figure should pop up:\n\n[![Output of `test_python.py`.](https://raw.githubusercontent.com/fatiando/transform21/master/test_install_output.png)](https://raw.githubusercontent.com/fatiando/transform21/master/test_install_output.png)\n\nIf none of these commands gives an error, then your installation should be working.\nIf you get any errors or the outputs look significantly different,\nplease let us know on Slack at `#t21-thurs-harmonica`.\n\n### Step 4\n\n**Start JupyterLab:**\n\n1. **Windows users:** Make sure you set a default browser that is **not Internet Explorer**.\n1. Activate the conda environment: `conda activate t21-thurs-harmonica`\n1. Start the JupyterLab server: `jupyter lab`\n1. Jupyter should open in your default web browser. We'll start from here in the\n   tutorial and create a new notebook together.\n\n### IF EVERYTHING ELSE FAILS\n\nIf you really can't get things to work on your computer,\nyou can run the code online through Google Colab (you will need a Google account).\nA starter notebook that installs Harmonica can be found here:\n\nhttps://swu.ng/t21-harmonica-colab\n\nTo save a copy of the Colab notebook to your own account, click on the\n\"Open in playground mode\" and then \"Save to Drive\".\nYou might be interested in\n[this tutorial](https://transform2020.sched.com/event/c7Jn/tutorial-using-python-subsurface-tools-no-install-required)\nfor an overview of Google Colab.\n\n#### I don't have a Google account\n\nIf you cannot use Google Colab, a second alternative option is to use to the\nSoftware Underground JupyterHub.\nYou need to sign in with your Slack credentials on this website:\nhttps://jupyter-dev.softwareunderground.org/\n\nFor more information about the login process, please read this:\nhttps://github.com/softwareunderground/jupyterhub-deployment/tree/first-deployment#login-process\n\nOnce you are logged in, JupyterHub will ask you to choose a server\nconfiguration, please choose the `t21-thurs-harmonica` option.\nAfter JupyterHub sets up an instance for you, it will prompt a JupyterLab\ninterface.\nIn order to create a new notebook for running during the tutorial, please click\nthe `Python [conda env:t21-thurs-harmonica]` button in the Launcher.\nIt will create a new notebook running the `t21-thurs-harmonica` environment, so\nyou don't need to install any dependency, they are already installed! 🎉\n\n\u003e ⚠️ The Software Undeground JupyterHub instances are still in **experimental\n\u003e phase**. You may expect some unwanted behaviour or sudden crushes. Use it\n\u003e carefully and download the notebook every once in a while to have a backup.⚠️\n\nThanks [Filippo Broggini](https://www.filippobroggini.com/) for setting this up!\n\n## License\n\nThis work is licensed under a\n[Creative Commons Attribution 4.0 International License][cc-by].\n\n[![CC BY 4.0][cc-by-image]][cc-by]\n\n[cc-by]: http://creativecommons.org/licenses/by/4.0/\n[cc-by-image]: https://i.creativecommons.org/l/by/4.0/88x31.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatiando%2Ftransform21","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffatiando%2Ftransform21","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatiando%2Ftransform21/lists"}