├── .gitattributes ├── .gitignore ├── README.md ├── Spatial Python Tutorial.ipynb ├── data ├── USGS_pp1766_Alluvial_Bnd.zip ├── i08_B118_CA_GroundwaterBasins.zip └── openet_ca_2022_1km_ensemble_4326.tif └── environment.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 105 | __pypackages__/ 106 | 107 | # Celery stuff 108 | celerybeat-schedule 109 | celerybeat.pid 110 | 111 | # SageMath parsed files 112 | *.sage.py 113 | 114 | # Environments 115 | .env 116 | .venv 117 | env/ 118 | venv/ 119 | ENV/ 120 | env.bak/ 121 | venv.bak/ 122 | 123 | # Spyder project settings 124 | .spyderproject 125 | .spyproject 126 | 127 | # Rope project settings 128 | .ropeproject 129 | 130 | # mkdocs documentation 131 | /site 132 | 133 | # mypy 134 | .mypy_cache/ 135 | .dmypy.json 136 | dmypy.json 137 | 138 | # Pyre type checker 139 | .pyre/ 140 | 141 | # pytype static type analyzer 142 | .pytype/ 143 | 144 | # Cython debug symbols 145 | cython_debug/ 146 | 147 | # PyCharm 148 | # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can 149 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 150 | # and can be added to the global gitignore or merged into this file. For a more nuclear 151 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 152 | #.idea/ 153 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spatial Python Tutorial 2 | 3 | An introduction to spatial data and processing spatial information using Python. 4 | 5 | ## Audience 6 | This tutorial is designed to be used by people who are already comfortable with databases, programming, and/or data 7 | science. It was developed as a tutorial for the US Research Software Engineer's Conference 2023 and assumes 8 | a similar skill level. Concepts related to data types, data querying, and programming in general are not 9 | explained. But it assumes no familiary with spatial information. 10 | 11 | ## Format 12 | This notebook is designed to be used self-contained, or instructor-led. If working through this without 13 | an instructor, make sure to read *all* the text - the comments are critical to explaining and understanding 14 | not just the code, but spatial data in general. 15 | 16 | ## Using the Tutorial 17 | This tutorial runs in the cloud on MyBinder.org - no setup is required on your computer to get started. 18 | MyBinder will usually load the notebook quickly - in a minute or two, but can take some time 19 | (as long as an hour) if it has been a long time since the notebook was last run. 20 | 21 | To get started, click the button below! 22 | 23 | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/nickrsan/spatial-python-tutorial/HEAD?labpath=Spatial%20Python%20Tutorial.ipynb) 24 | 25 | ## Funding Acknowledgment 26 | This tutorial was built as part of the [Secure Water Future](https://securewaterfuture.net) project. This work is supported 27 | by Agriculture and Food Research Initiative Competitive Grant no. 28 | 2021-69012-35916 from the USDA National Institute of Food and Agriculture. 29 | -------------------------------------------------------------------------------- /data/USGS_pp1766_Alluvial_Bnd.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nickrsan/spatial-python-tutorial/f19690d1718db57e06a1e6f37da3d9e10e17ae41/data/USGS_pp1766_Alluvial_Bnd.zip -------------------------------------------------------------------------------- /data/i08_B118_CA_GroundwaterBasins.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nickrsan/spatial-python-tutorial/f19690d1718db57e06a1e6f37da3d9e10e17ae41/data/i08_B118_CA_GroundwaterBasins.zip -------------------------------------------------------------------------------- /data/openet_ca_2022_1km_ensemble_4326.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nickrsan/spatial-python-tutorial/f19690d1718db57e06a1e6f37da3d9e10e17ae41/data/openet_ca_2022_1km_ensemble_4326.tif -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: spatial_python 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - python==3.10 6 | - pip 7 | 8 | - pandas 9 | - seaborn>=0.12.0 10 | - Rtree 11 | - cftime 12 | - netCDF4 13 | - pyproj 14 | - gdal 15 | - pygeos 16 | - rasterio 17 | - rasterstats 18 | - shapely 19 | - fiona 20 | - basemap 21 | - folium 22 | - geopandas 23 | - requests 24 | - mapclassify --------------------------------------------------------------------------------