Python module able to download a file from FTP and subset it using time-range,bounding-box,variables and depths
Project description
FTPsubsetMO - FTP subsetting service
I developed this software because motivated to improve my efficiency and productivity. It is just an attemp/idea/prototype and it is not fully optimased or considered stable.
Carmelo Sammarco
Be aware that:
The tool is in development so it can be possible find bugs, errors and imprecisions. Please to report them if you find one.
In the Database just the MY datasets are avaiable (still missing NRT datasets).
For more detailed information about the MULTI YEAR datasets please to look the MY_datasets file.
Introduction:
Python software which is able to download files over FTP protocol and subset the files retrieved by parameters as time-range, bounding box, variables and single/range Depth levels (below the GUI interface displayed on a Linux system).
Together with this tool is distribuited a database which store all the information needed to download the files from each datasets (type of data-set (NRT/MY), time steps (DAILY/MONTLY) and other two parameters needed to correctly identify and select the files prior the download. The key value to retrive such information is the FTP URL of the targeted dataset. It was ideated and implemented by me to adress the download automatization. However I really push the Producers to uniform all the data_structure/file_names and Metadata info (which will make easier the database creation/updates).
After the download which uses the python module "ftplib" (The files are downloaded in the same directory where the tool run) all the subsequent analyses are mainly performed with xarray (another python module). Below the full list of dependencies required (They are installed automatically during the installation if not avaiable in the python environment used):
- xarray
- ftputil>=3.4
- netCDF4
- pandas
- datetime
- os
- json
- hdf5
- h5py
- h5netcdf
What the user needs to input?
- CMEMS personal login credential
- Username
- Password
- FTP Link of the dataset (Our key value to extract from the data-base all the parameters needed to make the Tool works) as example below:
/Core/GLOBAL_REANALYSIS_PHY_001_025/global-reanalysis-phy-001-025-monthly/
- Time range
- Date start
- Date end
Date format as YYYY-MM-DD also in the case of the MONTHLY dataset where the term "DD" can be set to any real value.
-
Geographic bounding box (if interested to subset by geographic area)
-
Variables name (if interested in extract a selection rather than all)
-
Depths information parameter values (if interested in a SINGLE/RANGE or all the depths)
Python module/script installation:
Just type in the terminal/command-prompt:
pip install FTPsubsetMO
After that you are free to decide if you want to use the GUI interface or exexute it as script. The latter will allow the maximum customization but as cons it is not very user friendly.
To use the GUI interface just type on terminal/command-prompt:
FTPsubsetMO
After that just type on the pop upped screen the parameters asked/required. Finally just click on the red download button to start the download/subsetting process.
To use the program as a script and then be able to be free in look/modify/customise the code please to:
-
Open the Terminal/command_prompt in the location where you desire download the files or anyway have the script
-
Activate your python environment and import the module:
from FTPsubsetMO import script
- Run the function "script" as follow:
script()
The above function will allow you to add, in the path folder where you run the command, the files needed to run the subsetting process in a pure scripting way. "FTPsubsetMO.py" is the only file to modify based on your data request needs. The script's inputs are highlighted with "". More information can be found as form of comments in FTPsubsetMO.py script.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file FTPsubsetMO-0.5.6.tar.gz
.
File metadata
- Download URL: FTPsubsetMO-0.5.6.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d60ee9a78b199767fb96781aa35523dccf323d4745840857aec24ab4fce4295 |
|
MD5 | c1be493374e290a7c50124bec8e22813 |
|
BLAKE2b-256 | 34dba3b06f42f937a53111e21883be5cb749c33a6c911c908d16d8c8ad442b4c |
File details
Details for the file FTPsubsetMO-0.5.6-py3-none-any.whl
.
File metadata
- Download URL: FTPsubsetMO-0.5.6-py3-none-any.whl
- Upload date:
- Size: 193.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4d91aa91887ae5fcb665d2fa991b6026ca8f9059b76c71743ce9e25662e048b |
|
MD5 | c4c988d36ef47d2656b0e4028ee3d5be |
|
BLAKE2b-256 | 2c18d922210b0cb027d7c7740b1d7237f07530c14a17d4cf520a5ac1bf404488 |