Install surface flood training package¶

Installation of resources¶

Before you execute this notebook, ensure that within the EO Africa Innovation Lab you have created a folder 'surface_flood' and this notebook ('install_surface_flood.ipynb') is situated in the folder /surface_flood

In [1]:
import os
import glob
from zipfile import ZipFile
In [2]:
# list the current working directory - check the location of this notebook!
rd = os.getcwd()
print(rd)
/home/eoafrica/surface_flood
In [4]:
#transfer all required resources from online repository
!wget -r -np -nH --cut-dirs=4 -R "index.html*" https://filetransfer.itc.nl/pub/52n/EOAfrica_surface_flood/training_package.zip	
--2023-12-19 18:04:14--  https://filetransfer.itc.nl/pub/52n/EOAfrica_surface_flood/training_package.zip
Resolving filetransfer.itc.nl (filetransfer.itc.nl)... 130.89.1.190
Connecting to filetransfer.itc.nl (filetransfer.itc.nl)|130.89.1.190|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 109572639 (104M) [application/zip]
Saving to: ‘training_package.zip’

training_package.zi 100%[===================>] 104.50M  68.4MB/s    in 1.5s    

2023-12-19 18:04:16 (68.4 MB/s) - ‘training_package.zip’ saved [109572639/109572639]

FINISHED --2023-12-19 18:04:16--
Total wall clock time: 1.7s
Downloaded: 1 files, 104M in 1.5s (68.4 MB/s)
In [5]:
# unzip file Modules.zip
zips = glob.glob('training_package.zip')
for zip in zips:
    print('Extracting', zip)
    with ZipFile(zip, 'r') as z:
        z.extractall()
print('Done!')
Extracting training_package.zip
Done!
In [6]:
# run this code field to remove the downloaded zip files
!rm -rf training_package.zip
In [7]:
#create a few folders to store the data downloaded / created
folder = os.getcwd()+'/data'
os.chdir(".")
print("current dir is: %s" % (os.getcwd()))

if os.path.isdir(folder):
    print("Folder exists")
else:
    print("Folder doesn't exists")
    os.mkdir(folder)
current dir is: /home/eoafrica/surface_flood
Folder doesn't exists
In [10]:
#create a few folders to store the data downloaded / created
folder = os.getcwd()+'/WaPOR_Data'
os.chdir(".")
print("current dir is: %s" % (os.getcwd()))

if os.path.isdir(folder):
    print("Folder exists")
else:
    print("Folder doesn't exists")
    os.mkdir(folder)
current dir is: /home/eoafrica/surface_flood
Folder exists
In [11]:
#create a few folders to store the data downloaded / created
folder = os.getcwd()+'/glofas_data'
os.chdir(".")
print("current dir is: %s" % (os.getcwd()))

if os.path.isdir(folder):
    print("Folder exists")
else:
    print("Folder doesn't exists")
    os.mkdir(folder)
current dir is: /home/eoafrica/surface_flood
Folder doesn't exists

Install some required software / libraries¶

In [9]:
!pip install openeo
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: openeo in /home/eoafrica/.local/lib/python3.8/site-packages (0.25.0)
Requirement already satisfied: deprecated>=1.2.12 in /home/eoafrica/.local/lib/python3.8/site-packages (from openeo) (1.2.13)
Requirement already satisfied: xarray>=0.12.3 in /usr/local/lib/python3.8/dist-packages (from openeo) (2022.12.0)
Requirement already satisfied: numpy>=1.17.0 in /usr/local/lib/python3.8/dist-packages (from openeo) (1.22.4)
Requirement already satisfied: pandas>0.20.0 in /usr/local/lib/python3.8/dist-packages (from openeo) (1.5.3)
Requirement already satisfied: shapely>=1.6.4 in /usr/local/lib/python3.8/dist-packages (from openeo) (2.0.1)
Requirement already satisfied: importlib-resources in /usr/local/lib/python3.8/dist-packages (from openeo) (5.12.0)
Requirement already satisfied: requests>=2.26.0 in /usr/local/lib/python3.8/dist-packages (from openeo) (2.31.0)
Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.8/dist-packages (from deprecated>=1.2.12->openeo) (1.15.0)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.8/dist-packages (from pandas>0.20.0->openeo) (2023.3)
Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.8/dist-packages (from pandas>0.20.0->openeo) (2.8.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.8/dist-packages (from requests>=2.26.0->openeo) (3.1.0)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests>=2.26.0->openeo) (1.26.16)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests>=2.26.0->openeo) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests>=2.26.0->openeo) (2023.5.7)
Requirement already satisfied: packaging>=21.3 in /usr/local/lib/python3.8/dist-packages (from xarray>=0.12.3->openeo) (23.1)
Requirement already satisfied: zipp>=3.1.0 in /usr/local/lib/python3.8/dist-packages (from importlib-resources->openeo) (3.15.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/dist-packages (from python-dateutil>=2.8.1->pandas>0.20.0->openeo) (1.16.0)

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: python3 -m pip install --upgrade pip
In [10]:
!pip install ./software/ilwis-1.0.20230929-cp38-cp38-linux_x86_64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./software/ilwis-1.0.20230929-cp38-cp38-linux_x86_64.whl
ilwis is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: python3 -m pip install --upgrade pip
In [ ]: