Skip to content

Commit

Permalink
added init files
Browse files Browse the repository at this point in the history
  • Loading branch information
burrowsej committed Mar 9, 2023
1 parent f093c0d commit 8e28114
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 100
per-file-ignores = __init__.py:F401
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# secrets
.env

# data
.data/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.ipynb_checkpoints

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
site/

# keep all .gitkeep files and their parent folders
!.gitkeep
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
freeze:
pip freeze --exclude-editable | grep -v "file:///" > requirements.txt

verify:
isort --check-only .
black --diff --check .
flake8 .
pytest .

clean:
rm -r *.egg-info 2> /dev/null || true
py3clean .
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Bare soil analysis

Analysis of bare soil in fields across England.

## Inputs

Makes use of the following public data sources:

- Satellite reflectance data at 10m² resolution from ESA [Sentinel 2A](https://scihub.copernicus.eu).
- Land cover data at 10m² resolution from [UK CEH](https://catalogue.ceh.ac.uk/documents/017313c6-954b-4343-8784-3d61aa6e44da).
- Rainfall at 1km² resolution from Met Office [HadUK-Grid] (https://catalogue.ceda.ac.uk/uuid/4dc8450d889a491ebb20e724debe2dfb).
- LIDAR at 1m² from the Environment Agency's [National LIDAR Programme](https://www.data.gov.uk/dataset/f0db0249-f17b-4036-9e65-309148c97ce4/national-lidar-programme).


## Objective

The objective of this analysis is to build a model to detemine the best predictors of bare soil by building an explanatory model in python.
For the purposes of this study bare soil will be defined as where the Normalised Difference Vegetation Index (NDVI) is below 0.2, as calculated from Sentinel 2A red (B04) and near infared (B08) bands.

## Approach

The dependent variable will be NDVI, or where NDVI < 0.2.

The independant variables will include features engineered from the following aspects:

- Time, e.g. year, day of year
- Land use
- Topography, e.g. slope, altitude, adjacent slopes
- Adjacent vegetation
- Proximity to water courses
- Rainfall

A raster dataset will be created for a location in England and layers will be derived from the above datasets.
A best model will be selected through feature engineering and model selection.
Results will be discussed.
Empty file added bare_soils_analysis/__init__.py
Empty file.
Empty file added data/0_raw/.gitkeep
Empty file.
Empty file added data/1_proc/.gitkeep
Empty file.
35 changes: 35 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
affine==2.4.0
attrs==22.2.0
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
click-plugins==1.1.1
cligj==0.7.2
contextily==1.3.0
contourpy==1.0.7
cycler==0.11.0
fonttools==4.39.0
geographiclib==2.0
geopy==2.3.0
idna==3.4
joblib==1.2.0
kiwisolver==1.4.4
matplotlib==3.7.1
mercantile==1.2.1
numpy==1.24.2
packaging==23.0
pandas==1.5.3
Pillow==9.4.0
pyparsing==3.0.9
pyproj==3.4.1
python-dateutil==2.8.2
pytz==2022.7.1
rasterio==1.3.6
requests==2.28.2
rioxarray==0.13.4
seaborn==0.12.2
six==1.16.0
snuggs==1.4.7
urllib3==1.26.14
xarray==2023.2.0
xyzservices==2023.2.0
44 changes: 44 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from setuptools import find_packages, setup

__title__ = "bare_soil_analysis"
__description__ = "Analysis of bare soil across England"
__author_email__ = "Edward Burrows"
__author__ = "[email protected]"
__version__ = "0.1"
__licence__ = "MIT"

REQUIRED_PACKAGES = [
"rasterio>=1.3.6",
"pandas>=1.5.3",
"seaborn>=0.12.2",
"contextily>=1.3.0",
]

TEST_PACKAGES = [
"black>=23.1.0",
"flake8>=6.0.0",
"isort>=5.12.0",
"pytest>=7.2.1",
]

DEV_PACKAGES = [
*TEST_PACKAGES,
"pylint>=2.16.2",
"ipython>=8.10.0",
"ipykernel>=6.21.2",
"ipywidgets>=8.0.4",
"dbx>=0.7.0",
]


setup(
name=__title__,
description=__description__,
version=__version__,
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=REQUIRED_PACKAGES,
extras_require={"test": TEST_PACKAGES, "dev": DEV_PACKAGES},
author=__author__,
author_email=__author_email__,
licence=__licence__,
)

0 comments on commit 8e28114

Please sign in to comment.