Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task-2 DVC init #24

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions .dvc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/config.local
/tmp
/cache
4 changes: 4 additions & 0 deletions .dvc/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[core]
remote = storage
['remote "storage"']
url = gdrive://13pwaK4fUnV7nnWltM3n4DdqjcU3wvkqQ
3 changes: 3 additions & 0 deletions .dvcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
2 changes: 2 additions & 0 deletions Data/Climate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IPCC_ClimateZoneMap.ipynb

98 changes: 0 additions & 98 deletions Data/Climate/IPCC_ClimateZoneMap.ipynb

This file was deleted.

4 changes: 4 additions & 0 deletions Data/Climate/IPCC_ClimateZoneMap.ipynb.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
outs:
- md5: 5277092d7a4a5c248a593a46493f1617
size: 4405
path: IPCC_ClimateZoneMap.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Title: Global Soil Maps: Global Soil Organic Carbon Density in kg Carbon/m2 to 1 meter depth\n",
"\n",
"### Description\n",
"Soil organic carbon is a general term for the total of all the different non-living organic compounds in the soil, it also excludes dead plants and animals. The organic carbon in the soil is used by plants for nourishment as they grow, and the plants themselves replenish the resource when they decay after they die.<br>\n",
"\n",
"Although it would seem that high densities of soil carbon would correspond to areas where vegetation thrives, this is not necessarily the case. For example, the regions of the world categorized as tropical rainforest typically have very low quality soils - not because the soils are bad, rather because the highly active vegetation on the surface has already extracted most of the nutrient from the soil. The regions of the world where soil carbon accumulates, are therefore regions where vegetation growth is generally slower - such as swamps, bogs, and wetlands.<br>\n",
"\n",
"Values floating point 0-25 kg C/m2\n",
"\n",
"### FLINT\n",
"This dataset has been checked/pre-processed and is suitable for use in FLINT. Please adhere to individual dataset licence conditions and citations. Processed data can be accessed here: [Land Sector Datasets](https://datasets.mojaglobal.workers.dev/) https://datasets.mojaglobal.workers.dev/<br>\n",
"\n",
"### Format\n",
"<b>Extent: </b>Global coverage -180.0 -90.0 180.0 90.0 <br>\n",
"<b>Resolution:</b> Raster 0.5-degree resolution (this can be resampled to any resolution)<br>\n",
"<b>File type:</b> geotiff (.tif) and geojson (.json) float NoData -3.4028235e+38<br>\n",
"<b>Cordinate system:</b> EPSG:4326 (WGS84)<br>\n",
"<b>Year: </b>2002<br>\n",
"<b>Size:</b> 1MB<br>\n",
"\n",
"### Original source\n",
"Downloaded from: https://databasin.org/datasets/a4cb6d367eae4e52a08902874f8bfedf/ Accessed 19/12/2020 Sign in (free accounts available) to Data Basin to download.<br>\n",
"Grid, float; 0.5 resolution; Cordinate system: WGS1984\n",
"\n",
"### Licence\n",
"Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 3.0 License.\n",
"\n",
"### Citation\n",
"Title: Global Soil Organic Carbon Density in kg Carbon/m2 to 1 meter depth\n",
"Credits: IGBP-DIS (1998) SoilData(V.0) A program for creating global soil-property databases, IGBP Global Soils Data Task, France. Publication Date: 2002 http://www.sage.wisc.edu/atlas/maps.php?datasetid=21&includerelatedlinks=1&dataset=21\n",
"\n",
"### Metadata\n",
"View: https://databasin.org/datasets/a4cb6d367eae4e52a08902874f8bfedf/\n",
"\n",
"### Notes\n",
"Coarse resolution raster. Reample to finer resolution using code below. Values are floating but could be classified to integer or classes in QGIS, gdal_calc, gdal_reclassify or ArcPy.\n",
"\n",
"### Processing\n",
"Dataset converted to tiff, projection WGS84. Code is provided below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Convert from .rst to tif and apply WGS84 and resample to 0.5 (or other) resolution (enter resolution at -tr, file location and output)\n",
"ggdalwarp -s_srs EPSG:4326 -t_srs EPSG:4326 -tr 0.5 0.5 -r near -te -180.0 -90.0 180.0 90.0 -te_srs EPSG:4326 -of GTiff \"C:/Users/LennyJenny/Documents/ArcGIS/world/UNFCCC/downloads/Global Soil Organic Carbon Density in kg Carbon_m2 to 1 meter depth/Global Soil Organic Carbon Density in kg Carbon/Data0/soilcarbon.ovr\" C:/Data/data_process/tiff/GlobalSoilOrganicCarbonDensityinkgCm_1mDepth.tif"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
4 changes: 2 additions & 2 deletions Data/Soil/GlobalSoilOrganicCarbonDensitykgCm2to1mdepth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -72,7 +72,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
46 changes: 46 additions & 0 deletions GlobalSoilOrganicCarbonDensityinkgCarbon_m2to1meterdepth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Process Soil Data

on:
push:
branches:
- main

jobs:
update_soil_data:
name: Update Soil Data
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
cache: 'pip'

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgdal-dev gdal-bin
pip install numpy
pip install GDAL
pip install dvc[gdrive]

- name: Download and Process Data
run: |
wget -O soil_data.zip "https://databasin2-filestore.s3.amazonaws.com/a4cb6d367eae4e52a08902874f8bfedf/download/a4cb6d367eae4e52a08902874f8bfedf_1_zip_en.zip?Signature=ne2Aa6KK3wnmbjRWPPNV0TTecMw%3D&Expires=1679157927&AWSAccessKeyId=AKIAI4RK5BEPK3FCQPUQ"
unzip -o soil_data.zip -d Data/Soil
cd Data/Soil
python process.py
gdalwarp -to SRC_METHOD=NO_GEOTRANSFORM -s_srs EPSG:4326 -t_srs EPSG:4326 -tr 0.5 0.5 -r near -te -180.0 -90.0 180.0 90.0 -te_srs EPSG:4326 -of GTiff soilcarbon.ovr GlobalSoilOrganicCarbonDensityinkgCarbon_m2to1meterdepth.tif

- name: Commit and Push Changes
env:
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
cd Data/Soil
dvc add GlobalSoilOrganicCarbonDensityinkgCarbon_m2to1meterdepth.tif