smos.smos_l2 namespace¶
Submodules¶
smos.smos_l2.cli module¶
smos.smos_l2.download module¶
Module to synchronize SMOS L2 data from FTP to local disk
- class smos.smos_l2.download.SmosDissEoFtp(local_root, username=None, password=None, dotrc=None, skip_lftp_verify=False)[source]¶
Bases:
object- last_available_day()[source]¶
Get the latest available day on the server (incomplete directory). We want to exclude this day from downloading.
- Return type:
last_date
- list(subpath='', filter='all')[source]¶
Create a list of all files and subdirectories under the passed path on the server. Directories end with /, files should have a file extension.
- Parameters:
- Returns:
elements – List of all files and/or folders under the subpath on the server
- Return type:
- list_all_available_days(date_from=datetime.datetime(2010, 6, 1, 0, 0), date_to=datetime.datetime(2025, 9, 4, 16, 19, 5, 247441), progressbar=True)[source]¶
Shortcut to get a list of all available days (i.e. folders) on the server within the selected time frame.
- Parameters:
date_from (str or datetime, optional) – First date of the time frame to check available days for on server. By default, we use the first date of SMOS L2 (2010-06-01)
date_to (str or datetime, optional) – Last date of the time frame to check available days for on server. By default, we use the current date.
progressbar (bool, optional (default: True)) – This operation will send some request to the server and may take some time. (De)activate a visual progress representation.
- Returns:
dates – List of dates for which a folder exists on the server
- Return type:
- sync(year, month, day=None, opts='', dry_run=False)[source]¶
Download data from remote to local folder for a certain day.
- Parameters:
year (int) – Year part of the date to download
month (int) – Month part of the date to download
day (int, optional) – Day part of the date to download. If not set, then the whole month is synced.
opts (str, optional, default: '') – Additional options that are added to the command mirror OPTS root_dir target_dir For all options see https://lftp.yar.ru/lftp-man.html
dry_run (bool, optional, default=False) – Dry run does not actually download anything. Instead of the return value, the full command is returned
- Returns:
ret – Return value or command (if dry_run)
- Return type:
smos.smos_l2.reshuffle module¶
- smos.smos_l2.reshuffle.extend_ts(img_path, ts_path, memory=4, only_land=False)[source]¶
Append new image data to an existing time series record. This will use the last_day from summary.yml in the time series directory to decide which date the update should start from and the available image directories to decide how many images can be appended.
- smos.smos_l2.reshuffle.swath2ts(img_path, ts_path, variables=('Soil_Moisture', 'Science_Flags', 'Confidence_Flags', 'Chi_2_P', 'RFI_Prob', 'N_RFI_X', 'N_RFI_Y', 'M_AVA0'), startdate=None, enddate=None, memory=4, only_land=False)[source]¶
Convert SMOS L2 swath data to time series in IndexedRaggedTs format.
- Parameters:
img_path (str) – Local (root) directory where the annual folder containing SMOS L2 SM swath data are found.
ts_path (str) – Local directory where the converted time series data will be stored.
variables (tuple or str, optional (default: None)) – List of variables to include, None will use the default variables “Soil_Moisture”, “Soil_Moisture_DQX”, “Science_Flags”, “Confidence_Flags”, “Processing_Flags”, “Chi_2_P”, “RFI_Prob”, “N_RFI_X”, “N_RFI_Y”, “M_AVA0”, “acquisition_time”
startdate (str or datetime, optional (default: None)) – First day of the available swath data that should be included in the time series. If None is passed, then the first available day is used.
enddate (str or datetime, optional (default: None)) – Last day of the available swath data that should be included in the time series. If None is passed, then the last available day is used.
memory (float, optional (default: 4)) – Size of available memory in GB. More memory will lead to a faster conversion.