From 278076e8e926612a5c63c07fd4d12739ee4bdc11 Mon Sep 17 00:00:00 2001 From: augustinm Date: Wed, 9 Oct 2024 18:04:45 +0200 Subject: [PATCH 1/7] revisit CLI: run and l2b --- aprofiles/cli/__init__.py | 2 +- aprofiles/cli/{aprocess.py => apro.py} | 40 ++++-- aprofiles/cli/utils/__init__.py | 2 +- .../utils/{json_calendar.py => calendar.py} | 0 .../{json_climatology.py => climatology.py} | 0 aprofiles/cli/utils/l2b.py | 38 +++++ aprofiles/cli/utils/{json_map.py => map.py} | 0 docs/changelog.md | 7 + docs/cli.md | 134 ++++++++++++------ pyproject.toml | 5 +- 10 files changed, 169 insertions(+), 59 deletions(-) rename aprofiles/cli/{aprocess.py => apro.py} (82%) rename aprofiles/cli/utils/{json_calendar.py => calendar.py} (100%) rename aprofiles/cli/utils/{json_climatology.py => climatology.py} (100%) create mode 100644 aprofiles/cli/utils/l2b.py rename aprofiles/cli/utils/{json_map.py => map.py} (100%) diff --git a/aprofiles/cli/__init__.py b/aprofiles/cli/__init__.py index c8c942f..f5cc7c6 100644 --- a/aprofiles/cli/__init__.py +++ b/aprofiles/cli/__init__.py @@ -1 +1 @@ -from .utils import config, json_calendar, json_climatology, json_map, workflow \ No newline at end of file +from .utils import config, calendar, climatology, map, l2b, workflow \ No newline at end of file diff --git a/aprofiles/cli/aprocess.py b/aprofiles/cli/apro.py similarity index 82% rename from aprofiles/cli/aprocess.py rename to aprofiles/cli/apro.py index c79d779..86ddbd3 100755 --- a/aprofiles/cli/aprocess.py +++ b/aprofiles/cli/apro.py @@ -22,7 +22,7 @@ class InstrumentType(str, Enum): cl61 = "CL61" @app.command() -def main( +def run( _dates: List[datetime] = typer.Option( [], "--date", formats=["%Y-%m-%d"], help="๐Ÿ“… Processing date." ), @@ -66,9 +66,9 @@ def main( progress_bar: bool = typer.Option(True, help="โŒ› Show progress bar."), ): """ - Run aprofiles standard workflow for given dates, optionally for specific instruments types. + run aprofiles standard workflow for given dates and specific instruments types - See some examples here: https://a-profiles.readthedocs.io/en/latest/cli.html + see some examples [here](https://augustinmortier.github.io/a-profiles/cli/) """ #typer.echo(f"dates: {dates}, today: {today}, yesterday: {yesterday}, from: {_from}, to: {_to}, instruments_types: {instruments_types}, multiprocessing: {multiprocessing}") @@ -142,13 +142,13 @@ def main( calname = f"{yyyy}-{mm}-cal.json" path = Path(basedir_out, yyyy, mm, calname) if not path.is_file(): - utils.json_calendar.make_calendar(basedir_out, yyyy, mm, calname) + utils.calendar.make_calendar(basedir_out, yyyy, mm, calname) # list all files in out directory onlyfiles = [str(e) for e in datepath.iterdir() if e.is_file()] # add to calendar for file in track(onlyfiles, description="calendar ", disable=disable_progress_bar): - utils.json_calendar.add_to_calendar(file, basedir_out, yyyy, mm, dd, calname) + utils.calendar.add_to_calendar(file, basedir_out, yyyy, mm, dd, calname) if update_map: @@ -156,13 +156,13 @@ def main( mapname = f"{yyyy}-{mm}-map.json" path = Path(basedir_out, yyyy, mm, mapname) if not path.is_file(): - utils.json_map.make_map(basedir_out, yyyy, mm, mapname) + utils.map.make_map(basedir_out, yyyy, mm, mapname) # list all files in out directory onlyfiles = [str(e) for e in datepath.iterdir() if e.is_file()] # add to map for file in track(onlyfiles, description="map ", disable=disable_progress_bar): - utils.json_map.add_to_map(file, basedir_out, yyyy, mm, dd, mapname) + utils.map.add_to_map(file, basedir_out, yyyy, mm, dd, mapname) if update_climatology: # list all files in out directory @@ -177,7 +177,7 @@ def main( task = progress.add_task(total=len(stations_id), description=f"clim. :rocket:", visible=not disable_progress_bar) with concurrent.futures.ProcessPoolExecutor(max_workers=workers) as executor: futures = [executor.submit( - utils.json_climatology.compute_climatology, + utils.climatology.compute_climatology, basedir_out, station_id, season_variables=["extinction"], @@ -189,8 +189,30 @@ def main( progress.update(task, advance=1) else: for station_id in track(stations_id, description='clim. ', disable=disable_progress_bar): - utils.json_climatology.compute_climatology(basedir_out, station_id, season_variables=["extinction"], all_variables=["aod", "lidar_ratio"], aerosols_only=True) + utils.climatology.compute_climatology(basedir_out, station_id, season_variables=["extinction"], all_variables=["aod", "lidar_ratio"], aerosols_only=True) +@app.command() +def l2b( + basedir_in: Path = typer.Option( + "data/v-profiles", exists=True, readable=True, help="๐Ÿ“‚ Base path for input data." + ), + basedir_out: Path = typer.Option( + "data/l2b", exists=True, writable=True, help="๐Ÿ“‚ Base path for output data." + ), + progress_bar: bool = typer.Option(True, help="โŒ› Show progress bar.") + ): + """ + make E-PROFILE L2b files out of AP files + """ + + # if basedir_in is "data/v-profiles", use today's date to find the directory + if basedir_in == Path("data/v-profiles"): + # get todays date + today = datetime.today() + basedir_in = Path(basedir_in, today.strftime('%Y'), today.strftime('%m'), today.strftime('%d')) + + utils.l2b.make_files(basedir_in, basedir_out, progress_bar) + if __name__ == "__main__": app() diff --git a/aprofiles/cli/utils/__init__.py b/aprofiles/cli/utils/__init__.py index 95f7cbf..089bb83 100644 --- a/aprofiles/cli/utils/__init__.py +++ b/aprofiles/cli/utils/__init__.py @@ -1 +1 @@ -from . import json_calendar, json_climatology, json_map, config, workflow \ No newline at end of file +from . import calendar, climatology, map, l2b, config, workflow \ No newline at end of file diff --git a/aprofiles/cli/utils/json_calendar.py b/aprofiles/cli/utils/calendar.py similarity index 100% rename from aprofiles/cli/utils/json_calendar.py rename to aprofiles/cli/utils/calendar.py diff --git a/aprofiles/cli/utils/json_climatology.py b/aprofiles/cli/utils/climatology.py similarity index 100% rename from aprofiles/cli/utils/json_climatology.py rename to aprofiles/cli/utils/climatology.py diff --git a/aprofiles/cli/utils/l2b.py b/aprofiles/cli/utils/l2b.py new file mode 100644 index 0000000..97ccd1a --- /dev/null +++ b/aprofiles/cli/utils/l2b.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +import os +import sys +from pathlib import Path + +from glob import glob + +import xarray as xr +import pandas as pd +from rich.progress import track + +def make_files(path_in: Path, path_out: Path, progress_bar: bool) -> None: + + # list all AP files in path_in + files = glob(f"{path_in}/AP*nc") + + for f in track(files, description=f"Reading AP files", disable=not progress_bar): + + ds = xr.open_dataset(f, decode_times=True, chunks=-1).load() + # get unique id and extract yyyymmdd from first time step + unique_id = f"{ds.attrs['wigos_station_id']}_{ds.attrs['instrument_id']}" + yyyymmdd = str(ds.time.data[0].astype('M8[D]')).replace('-','') + + ntimes = ds.time.size + if ntimes < 60: + myrange = range(ntimes) + else: + myrange = range(ntimes-12, ntimes) + + for i in myrange: + ds1t = ds.isel(time=i) + mmhh = pd.to_datetime(ds1t.time.data).strftime('%H%M') + file_name = Path(path_out, f"{unique_id}_{yyyymmdd}{mmhh}.nc") + ds1t.to_netcdf('out.nc') + os.rename('out.nc',file_name) + + diff --git a/aprofiles/cli/utils/json_map.py b/aprofiles/cli/utils/map.py similarity index 100% rename from aprofiles/cli/utils/json_map.py rename to aprofiles/cli/utils/map.py diff --git a/docs/changelog.md b/docs/changelog.md index 2ee0c72..0146cf2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,13 @@ :material-history:{ style="text-align: center; font-size: xx-large; display: block" } +## 0.10.0 +Oct 10, 2024 + +- revisit CLI: two commands + - `apro run` (formerly `aprocess`: run standard workflow) + - `apro l2b` (creates L2b files out of AP files) + ## 0.9.7 Oct 3, 2024 diff --git a/docs/cli.md b/docs/cli.md index 1e655b5..343f27b 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -4,7 +4,7 @@ For facilitating the processing of the measurements in routine, a Command Line Interface (CLI) has been developed: -[cli/aprocess.py](cli/aprocess.py){: .download} +[cli/apro.py](cli/apro.py){: .download} In the current version, the CLI has 3 possible actions: @@ -31,83 +31,125 @@ poetry install --extras cli ## Documentation - aprocess --help - -returns the documentation of the CLI, with all available options. +`apro` commands which can be listed with +``` console +apro --help + + Usage: apro [OPTIONS] COMMAND [ARGS]... + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --install-completion Install completion for the current shell. โ”‚ +โ”‚ --show-completion Show completion for the current shell, to copy it or customize the installation. โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ•ญโ”€ Commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ l2b make E-PROFILE L2b files out of AP files โ”‚ +โ”‚ run run aprofiles standard workflow for given dates and specific instruments types โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` -$ย aprocess --help - -Usage: aprocess [OPTIONS] -Run aprofiles standard workflow for given dates, optionally for specific instruments types. -See some examples here: https://a-profiles.readthedocs.io/en/latest/cli.html +### `run` command -โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ --date [%Y-%m-%d] ๐Ÿ“… Processing date. โ”‚ -โ”‚ --from [%Y-%m-%d] ๐Ÿ“… Initial date. [default: None] โ”‚ -โ”‚ --to [%Y-%m-%d] ๐Ÿ“… Ending date. [default: (Today's date)] โ”‚ -โ”‚ --today --no-today ๐Ÿ•‘ Process today's data. [default: no-today] โ”‚ -โ”‚ --yesterday --no-yesterday ๐Ÿ•™ Process yesterday's data. [default: no-yesterday] โ”‚ -โ”‚ --instruments-type [CHM15k|Mini-MPL|CL61] ๐Ÿ“— List of specific instruments to be processed. [default: CHM15k, Mini-MPL] โ”‚ -โ”‚ --multiprocessing --no-multiprocessing ๐Ÿš€ Use multiprocessing mode. [default: no-multiprocessing] โ”‚ -โ”‚ --workers INTEGER RANGE [x>=1] ๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode is enabled). [env var: NSLOTS] โ”‚ -โ”‚ [default: 2] โ”‚ -โ”‚ --basedir-in PATH ๐Ÿ“‚ Base path for input data. [default: data/e-profile] โ”‚ -โ”‚ --basedir-out PATH ๐Ÿ“‚ Base path for output data. [default: data/v-profiles] โ”‚ -โ”‚ --apriori-cfg PATH ๐Ÿ“‚ Base path for a priori config file. [default: config] โ”‚ -โ”‚ --update-data --no-update-data ๐Ÿ“ˆ Update data. [default: update-data] โ”‚ -โ”‚ --update-calendar --no-update-calendar ๐Ÿ—“๏ธ Update calendar. [default: update-calendar] โ”‚ -โ”‚ --update-map --no-update-map ๐Ÿ—บ๏ธ Update map. [default: update-map] โ”‚ -โ”‚ --update-climatology --no-update-climatology โ†ช๏ธ Update climatology. [default: update-climatology] โ”‚ -โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ -โ”‚ --install-completion Install completion for the current shell. โ”‚ -โ”‚ --show-completion Show completion for the current shell, to copy it or customize the installation. โ”‚ -โ”‚ --help Show this message and exit. โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +``` +apro run --help + + Usage: apro run [OPTIONS] + + run aprofiles standard workflow for given dates and specific instruments types + see some examples [here](https://augustinmortier.github.io/a-profiles/cli/) + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --date [%Y-%m-%d] ๐Ÿ“… Processing date. โ”‚ +โ”‚ --from [%Y-%m-%d] ๐Ÿ“… Initial date. [default: None] โ”‚ +โ”‚ --to [%Y-%m-%d] ๐Ÿ“… Ending date. [default: (Today's date)] โ”‚ +โ”‚ --today --no-today ๐Ÿ•‘ Process today's data. [default: no-today] โ”‚ +โ”‚ --yesterday --no-yesterday ๐Ÿ•™ Process yesterday's data. [default: no-yesterday] โ”‚ +โ”‚ --instruments-type [CHM15k|Mini-MPL|CL61] ๐Ÿ“— List of specific instruments to be processed. โ”‚ +โ”‚ [default: CHM15k, Mini-MPL] โ”‚ +โ”‚ --multiprocessing --no-multiprocessing ๐Ÿš€ Use multiprocessing mode. โ”‚ +โ”‚ [default: no-multiprocessing] โ”‚ +โ”‚ --workers INTEGER RANGE [x>=1] ๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode iโ€ฆ โ”‚ +โ”‚ enabled). โ”‚ +โ”‚ [env var: NSLOTS] โ”‚ +โ”‚ [default: 2] โ”‚ +โ”‚ --basedir-in PATH ๐Ÿ“‚ Base path for input data. [default: data/e-profile] โ”‚ +โ”‚ --basedir-out PATH ๐Ÿ“‚ Base path for output data. [default: data/v-profiles] โ”‚ +โ”‚ --apriori-cfg PATH ๐Ÿ“‚ Base path for a priori config file. [default: config] โ”‚ +โ”‚ --update-data --no-update-data ๐Ÿ“ˆ Update data. [default: update-data] โ”‚ +โ”‚ --update-calendar --no-update-calendar ๐Ÿ—“๏ธ Update calendar. [default: update-calendar] โ”‚ +โ”‚ --update-map --no-update-map ๐Ÿ—บ๏ธ Update map. [default: update-map] โ”‚ +โ”‚ --update-climatology --no-update-climatology โ†ช๏ธ Update climatology. [default: update-climatology] โ”‚ +โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` -## Basic uses +#### Examples -### run a specific date +##### run a specific date ``` -aprocess --date 2021-09-09 +apro run --date 2021-09-09 ``` -### run today\'s files +##### run today\'s files ``` -aprocess --today +apro run --today ``` -### run yesterday\'s files +##### run yesterday\'s files ``` -aprocess --yesterday +apro run --yesterday ``` -## More advanced uses - It is possible to combine different options. -### run today\'s and yesterday\'s files for CHM15k only +##### run today\'s and yesterday\'s files for CHM15k only ``` -aprocess --today --yesterday --instruments-type CHM15k +apro run --today --yesterday --instruments-type CHM15k ``` -### update only calendar files for 2021 +##### update only calendar files for 2021 ``` -aprocess --from 2021-01-01 --to 2021-12-31 --no-update-data --no-update-map +apro run --from 2021-01-01 --to 2021-12-31 --no-update-data --no-update-map ``` -### use multiprocessing +##### use multiprocessing The data processing can be run in parallel by using the [`multiprocessing`] option : ``` -aprocess --today --yesterday --multiprocessing +apro run --today --yesterday --multiprocessing +``` + + +### `l2b` command + +``` +apro l2b --help + + Usage: apro l2b [OPTIONS] + + make E-PROFILE L2b files out of AP files + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --basedir-in PATH ๐Ÿ“‚ Base path for input data. [default: data/v-profiles] โ”‚ +โ”‚ --basedir-out PATH ๐Ÿ“‚ Base path for output data. [default: data/l2b] โ”‚ +โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` + +#### Examples + +##### make L2b files out of today's AP files in default directory + +```bash +apro l2b +``` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index a1fff5f..41dbfd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "aprofiles" -version = "0.9.7" +version = "0.10.0" description = "Analysis of atmospheric profilers measurements" authors = ["augustinm "] license = "GPL-3.0" [tool.poetry.scripts] -aprocess = {callable = "aprofiles.cli.aprocess:app", extras = ["cli"]} +apro = {callable = "aprofiles.cli.apro:app", extras = ["cli"]} [tool.poetry.dependencies] python = ">=3.10,<3.13" @@ -39,6 +39,7 @@ pymdown-extensions = "^10.10" mkdocstrings = {extras = ["python"], version = "^0.26.1"} markdown-include = "^0.8.1" mkdocs-copy = "^0.0.1" +ipywidgets = "^8.1.5" [build-system] requires = ["poetry-core>=1.0.0"] From 119b2609c3afddcfa8d5677797ac2e1c8c665d68 Mon Sep 17 00:00:00 2001 From: augustinm Date: Wed, 9 Oct 2024 18:12:51 +0200 Subject: [PATCH 2/7] replace basedir by path --- aprofiles/cli/apro.py | 40 +++++++++++++++--------------- aprofiles/cli/utils/calendar.py | 10 ++++---- aprofiles/cli/utils/climatology.py | 6 ++--- aprofiles/cli/utils/map.py | 10 ++++---- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/aprofiles/cli/apro.py b/aprofiles/cli/apro.py index 86ddbd3..35800f8 100755 --- a/aprofiles/cli/apro.py +++ b/aprofiles/cli/apro.py @@ -45,10 +45,10 @@ def run( workers: int = typer.Option( 2, "--workers", min=1, envvar="NSLOTS", help="๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode is enabled)." ), - basedir_in: Path = typer.Option( + path_in: Path = typer.Option( "data/e-profile", exists=True, readable=True, help="๐Ÿ“‚ Base path for input data." ), - basedir_out: Path = typer.Option( + path_out: Path = typer.Option( "data/v-profiles", exists=True, writable=True, @@ -110,7 +110,7 @@ def run( dd = str(date.day).zfill(2) # list all files in in directory - datepath = Path(basedir_in, yyyy, mm, dd) + datepath = Path(path_in, yyyy, mm, dd) onlyfiles = [str(e) for e in datepath.iterdir() if e.is_file()] # data processing @@ -123,7 +123,7 @@ def run( utils.workflow.workflow, path=file, instruments_types=instruments_types, - base_dir=basedir_out, CFG=CFG, verbose=False + base_dir=path_out, CFG=CFG, verbose=False ) for file in onlyfiles] for future in concurrent.futures.as_completed(futures): @@ -131,38 +131,38 @@ def run( else: for file in track(onlyfiles, description=f"{date.strftime('%Y-%m-%d')} ", disable=disable_progress_bar): utils.workflow.workflow( - file, instruments_types, basedir_out, CFG, verbose=False + file, instruments_types, path_out, CFG, verbose=False ) # list all files in out directory - datepath = Path(basedir_out, yyyy, mm, dd) + datepath = Path(path_out, yyyy, mm, dd) if update_calendar: # create calendar calname = f"{yyyy}-{mm}-cal.json" - path = Path(basedir_out, yyyy, mm, calname) + path = Path(path_out, yyyy, mm, calname) if not path.is_file(): - utils.calendar.make_calendar(basedir_out, yyyy, mm, calname) + utils.calendar.make_calendar(path_out, yyyy, mm, calname) # list all files in out directory onlyfiles = [str(e) for e in datepath.iterdir() if e.is_file()] # add to calendar for file in track(onlyfiles, description="calendar ", disable=disable_progress_bar): - utils.calendar.add_to_calendar(file, basedir_out, yyyy, mm, dd, calname) + utils.calendar.add_to_calendar(file, path_out, yyyy, mm, dd, calname) if update_map: # create map mapname = f"{yyyy}-{mm}-map.json" - path = Path(basedir_out, yyyy, mm, mapname) + path = Path(path_out, yyyy, mm, mapname) if not path.is_file(): - utils.map.make_map(basedir_out, yyyy, mm, mapname) + utils.map.make_map(path_out, yyyy, mm, mapname) # list all files in out directory onlyfiles = [str(e) for e in datepath.iterdir() if e.is_file()] # add to map for file in track(onlyfiles, description="map ", disable=disable_progress_bar): - utils.map.add_to_map(file, basedir_out, yyyy, mm, dd, mapname) + utils.map.add_to_map(file, path_out, yyyy, mm, dd, mapname) if update_climatology: # list all files in out directory @@ -178,7 +178,7 @@ def run( with concurrent.futures.ProcessPoolExecutor(max_workers=workers) as executor: futures = [executor.submit( utils.climatology.compute_climatology, - basedir_out, + path_out, station_id, season_variables=["extinction"], all_variables=["aod", "lidar_ratio"], @@ -189,15 +189,15 @@ def run( progress.update(task, advance=1) else: for station_id in track(stations_id, description='clim. ', disable=disable_progress_bar): - utils.climatology.compute_climatology(basedir_out, station_id, season_variables=["extinction"], all_variables=["aod", "lidar_ratio"], aerosols_only=True) + utils.climatology.compute_climatology(path_out, station_id, season_variables=["extinction"], all_variables=["aod", "lidar_ratio"], aerosols_only=True) @app.command() def l2b( - basedir_in: Path = typer.Option( + path_in: Path = typer.Option( "data/v-profiles", exists=True, readable=True, help="๐Ÿ“‚ Base path for input data." ), - basedir_out: Path = typer.Option( + path_out: Path = typer.Option( "data/l2b", exists=True, writable=True, help="๐Ÿ“‚ Base path for output data." ), progress_bar: bool = typer.Option(True, help="โŒ› Show progress bar.") @@ -206,13 +206,13 @@ def l2b( make E-PROFILE L2b files out of AP files """ - # if basedir_in is "data/v-profiles", use today's date to find the directory - if basedir_in == Path("data/v-profiles"): + # if path_in is "data/v-profiles", use today's date to find the directory + if path_in == Path("data/v-profiles"): # get todays date today = datetime.today() - basedir_in = Path(basedir_in, today.strftime('%Y'), today.strftime('%m'), today.strftime('%d')) + path_in = Path(path_in, today.strftime('%Y'), today.strftime('%m'), today.strftime('%d')) - utils.l2b.make_files(basedir_in, basedir_out, progress_bar) + utils.l2b.make_files(path_in, path_out, progress_bar) if __name__ == "__main__": app() diff --git a/aprofiles/cli/utils/calendar.py b/aprofiles/cli/utils/calendar.py index 91dbc0c..e3fc298 100644 --- a/aprofiles/cli/utils/calendar.py +++ b/aprofiles/cli/utils/calendar.py @@ -7,12 +7,12 @@ import xarray as xr -def make_calendar(base_dir, yyyy, mm, calname): +def make_calendar(path, yyyy, mm, calname): # one calendar, per month - with open(Path(base_dir, yyyy, mm, calname), 'w') as json_file: + with open(Path(path, yyyy, mm, calname), 'w') as json_file: json.dump({}, json_file) -def add_to_calendar(fn, base_dir, yyyy, mm, dd, calname): +def add_to_calendar(fn, path, yyyy, mm, dd, calname): # calendar collects the number of inversions with no low-level clouds (<6km) at each station # for each station, write number of each scene class (aer, cloud<6km, cloud>6km, ) @@ -28,7 +28,7 @@ def add_to_calendar(fn, base_dir, yyyy, mm, dd, calname): scene_counts['total'] = len(ds.retrieval_scene.data) # open current calendar - with open(Path(base_dir, yyyy, mm, calname), 'r') as json_file: + with open(Path(path, yyyy, mm, calname), 'r') as json_file: data = json.load(json_file) json_file.close() @@ -39,5 +39,5 @@ def add_to_calendar(fn, base_dir, yyyy, mm, dd, calname): data[station_id][dd] = scene_counts # write new calendar - with open(Path(base_dir, yyyy, mm, calname), 'w') as json_file: + with open(Path(path, yyyy, mm, calname), 'w') as json_file: json.dump(data, json_file) diff --git a/aprofiles/cli/utils/climatology.py b/aprofiles/cli/utils/climatology.py index fc261b6..b8713d4 100644 --- a/aprofiles/cli/utils/climatology.py +++ b/aprofiles/cli/utils/climatology.py @@ -10,10 +10,10 @@ import xarray as xr -def compute_climatology(basedir, station_id, season_variables, all_variables, aerosols_only): +def compute_climatology(path, station_id, season_variables, all_variables, aerosols_only): # get all files station_files = [] - for root, dirs, files in os.walk(basedir, followlinks=True): + for root, dirs, files in os.walk(path, followlinks=True): for file in files: if station_id in file and file.endswith(".nc"): station_files.append(os.path.join(root, file)) @@ -67,7 +67,7 @@ def compute_climatology(basedir, station_id, season_variables, all_variables, ae multivars_dict["attrs"] = attrs # define path - clim_path = Path(basedir, "climato") + clim_path = Path(path, "climato") # create directory if does not exist clim_path.mkdir(parents=True, exist_ok=True) diff --git a/aprofiles/cli/utils/map.py b/aprofiles/cli/utils/map.py index d251a23..25f8036 100644 --- a/aprofiles/cli/utils/map.py +++ b/aprofiles/cli/utils/map.py @@ -9,12 +9,12 @@ import xarray as xr -def make_map(base_dir, yyyy, mm, mapname): +def make_map(path, yyyy, mm, mapname): # one map, per day, which collects the maximum extinction with no low-level clouds (<6km) at each station - with open(Path(base_dir) / yyyy / mm / mapname, 'w') as json_file: + with open(Path(path) / yyyy / mm / mapname, 'w') as json_file: json.dump({}, json_file) -def add_to_map(fn, base_dir, yyyy, mm, dd, mapname): +def add_to_map(fn, path, yyyy, mm, dd, mapname): # map collects the maximum extinction value with no low-level clouds (<6km) at each station at a hourly resolution # for each station, write an array with extinction values, and array with scenes for each hour of the day @@ -51,7 +51,7 @@ def add_to_map(fn, base_dir, yyyy, mm, dd, mapname): mean_lidar_ratio = ds.lidar_ratio.resample(time='1h').mean().data # open current map - with open(Path(base_dir) / yyyy / mm / mapname, 'r') as json_file: + with open(Path(path) / yyyy / mm / mapname, 'r') as json_file: data = json.load(json_file) json_file.close() @@ -81,5 +81,5 @@ def add_to_map(fn, base_dir, yyyy, mm, dd, mapname): } # write new map - with open(Path(base_dir) / yyyy / mm / mapname, 'w') as json_file: + with open(Path(path) / yyyy / mm / mapname, 'w') as json_file: json.dump(data, json_file) From 975140b192413fbc184e1edf3023d32ec5524e4a Mon Sep 17 00:00:00 2001 From: augustinm Date: Wed, 9 Oct 2024 18:16:15 +0200 Subject: [PATCH 3/7] update documentation --- docs/cli.md | 82 ++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 343f27b..27c4992 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -54,36 +54,36 @@ apro --help ``` apro run --help - - Usage: apro run [OPTIONS] - - run aprofiles standard workflow for given dates and specific instruments types - see some examples [here](https://augustinmortier.github.io/a-profiles/cli/) - -โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ --date [%Y-%m-%d] ๐Ÿ“… Processing date. โ”‚ -โ”‚ --from [%Y-%m-%d] ๐Ÿ“… Initial date. [default: None] โ”‚ -โ”‚ --to [%Y-%m-%d] ๐Ÿ“… Ending date. [default: (Today's date)] โ”‚ -โ”‚ --today --no-today ๐Ÿ•‘ Process today's data. [default: no-today] โ”‚ -โ”‚ --yesterday --no-yesterday ๐Ÿ•™ Process yesterday's data. [default: no-yesterday] โ”‚ -โ”‚ --instruments-type [CHM15k|Mini-MPL|CL61] ๐Ÿ“— List of specific instruments to be processed. โ”‚ -โ”‚ [default: CHM15k, Mini-MPL] โ”‚ -โ”‚ --multiprocessing --no-multiprocessing ๐Ÿš€ Use multiprocessing mode. โ”‚ -โ”‚ [default: no-multiprocessing] โ”‚ -โ”‚ --workers INTEGER RANGE [x>=1] ๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode iโ€ฆ โ”‚ -โ”‚ enabled). โ”‚ -โ”‚ [env var: NSLOTS] โ”‚ -โ”‚ [default: 2] โ”‚ -โ”‚ --basedir-in PATH ๐Ÿ“‚ Base path for input data. [default: data/e-profile] โ”‚ -โ”‚ --basedir-out PATH ๐Ÿ“‚ Base path for output data. [default: data/v-profiles] โ”‚ -โ”‚ --apriori-cfg PATH ๐Ÿ“‚ Base path for a priori config file. [default: config] โ”‚ -โ”‚ --update-data --no-update-data ๐Ÿ“ˆ Update data. [default: update-data] โ”‚ -โ”‚ --update-calendar --no-update-calendar ๐Ÿ—“๏ธ Update calendar. [default: update-calendar] โ”‚ -โ”‚ --update-map --no-update-map ๐Ÿ—บ๏ธ Update map. [default: update-map] โ”‚ -โ”‚ --update-climatology --no-update-climatology โ†ช๏ธ Update climatology. [default: update-climatology] โ”‚ -โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ -โ”‚ --help Show this message and exit. โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ + + Usage: apro run [OPTIONS] + + run aprofiles standard workflow for given dates and specific instruments types + see some examples [here](https://augustinmortier.github.io/a-profiles/cli/) + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --date [%Y-%m-%d] ๐Ÿ“… Processing date. โ”‚ +โ”‚ --from [%Y-%m-%d] ๐Ÿ“… Initial date. [default: None] โ”‚ +โ”‚ --to [%Y-%m-%d] ๐Ÿ“… Ending date. [default: (Today's date)] โ”‚ +โ”‚ --today --no-today ๐Ÿ•‘ Process today's data. [default: no-today] โ”‚ +โ”‚ --yesterday --no-yesterday ๐Ÿ•™ Process yesterday's data. [default: no-yesterday] โ”‚ +โ”‚ --instruments-type [CHM15k|Mini-MPL|CL61] ๐Ÿ“— List of specific instruments to be processed. โ”‚ +โ”‚ [default: CHM15k, Mini-MPL] โ”‚ +โ”‚ --multiprocessing --no-multiprocessing ๐Ÿš€ Use multiprocessing mode. โ”‚ +โ”‚ [default: no-multiprocessing] โ”‚ +โ”‚ --workers INTEGER RANGE [x>=1] ๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode is โ”‚ +โ”‚ enabled). โ”‚ +โ”‚ [env var: NSLOTS] โ”‚ +โ”‚ [default: 2] โ”‚ +โ”‚ --path-in PATH ๐Ÿ“‚ Base path for input data. [default: data/e-profile] โ”‚ +โ”‚ --path-out PATH ๐Ÿ“‚ Base path for output data. [default: data/v-profiles] โ”‚ +โ”‚ --apriori-cfg PATH ๐Ÿ“‚ Base path for a priori config file. [default: config] โ”‚ +โ”‚ --update-data --no-update-data ๐Ÿ“ˆ Update data. [default: update-data] โ”‚ +โ”‚ --update-calendar --no-update-calendar ๐Ÿ—“๏ธ Update calendar. [default: update-calendar] โ”‚ +โ”‚ --update-map --no-update-map ๐Ÿ—บ๏ธ Update map. [default: update-map] โ”‚ +โ”‚ --update-climatology --no-update-climatology โ†ช๏ธ Update climatology. [default: update-climatology] โ”‚ +โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` #### Examples @@ -133,17 +133,17 @@ apro run --today --yesterday --multiprocessing ``` apro l2b --help - - Usage: apro l2b [OPTIONS] - - make E-PROFILE L2b files out of AP files - -โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ --basedir-in PATH ๐Ÿ“‚ Base path for input data. [default: data/v-profiles] โ”‚ -โ”‚ --basedir-out PATH ๐Ÿ“‚ Base path for output data. [default: data/l2b] โ”‚ -โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ -โ”‚ --help Show this message and exit. โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ + + Usage: apro l2b [OPTIONS] + + make E-PROFILE L2b files out of AP files + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --path-in PATH ๐Ÿ“‚ Base path for input data. [default: data/v-profiles] โ”‚ +โ”‚ --path-out PATH ๐Ÿ“‚ Base path for output data. [default: data/l2b] โ”‚ +โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` #### Examples From e66185b8f7552fe1cd559beea3ba055e3e664bee Mon Sep 17 00:00:00 2001 From: augustinm Date: Wed, 9 Oct 2024 18:21:08 +0200 Subject: [PATCH 4/7] update documentation --- docs/cli.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 27c4992..7a3a696 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -19,21 +19,21 @@ required extras: :simple-pipx: via *pip/pipx* -``` +``` bash pip install .[cli] ``` :simple-poetry: via *poetry* -``` +``` bash poetry install --extras cli ``` ## Documentation -`apro` commands which can be listed with +`apro` commands can be listed with `apro --help` -``` console +``` bash apro --help Usage: apro [OPTIONS] COMMAND [ARGS]... @@ -52,7 +52,7 @@ apro --help ### `run` command -``` +``` bash apro run --help Usage: apro run [OPTIONS] @@ -90,19 +90,19 @@ apro run --help ##### run a specific date -``` +``` bash apro run --date 2021-09-09 ``` ##### run today\'s files -``` +``` bash apro run --today ``` ##### run yesterday\'s files -``` +``` bash apro run --yesterday ``` @@ -110,13 +110,13 @@ It is possible to combine different options. ##### run today\'s and yesterday\'s files for CHM15k only -``` +``` bash apro run --today --yesterday --instruments-type CHM15k ``` ##### update only calendar files for 2021 -``` +``` bash apro run --from 2021-01-01 --to 2021-12-31 --no-update-data --no-update-map ``` @@ -124,14 +124,14 @@ apro run --from 2021-01-01 --to 2021-12-31 --no-update-data --no-update-map The data processing can be run in parallel by using the [`multiprocessing`] option : -``` +``` bash apro run --today --yesterday --multiprocessing ``` ### `l2b` command -``` +``` bash apro l2b --help Usage: apro l2b [OPTIONS] From 87df97b0ffb5e8b0ee8d3e55da1fedd6066e74c9 Mon Sep 17 00:00:00 2001 From: augustinm Date: Thu, 10 Oct 2024 08:55:41 +0200 Subject: [PATCH 5/7] edit L2B file names --- aprofiles/cli/utils/l2b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprofiles/cli/utils/l2b.py b/aprofiles/cli/utils/l2b.py index 97ccd1a..7a7ca64 100644 --- a/aprofiles/cli/utils/l2b.py +++ b/aprofiles/cli/utils/l2b.py @@ -31,7 +31,7 @@ def make_files(path_in: Path, path_out: Path, progress_bar: bool) -> None: for i in myrange: ds1t = ds.isel(time=i) mmhh = pd.to_datetime(ds1t.time.data).strftime('%H%M') - file_name = Path(path_out, f"{unique_id}_{yyyymmdd}{mmhh}.nc") + file_name = Path(path_out, f"L2B_{unique_id}{yyyymmdd}{mmhh}.nc") ds1t.to_netcdf('out.nc') os.rename('out.nc',file_name) From 7139820ecfa343fa60ecb82d5294c81adb36dae3 Mon Sep 17 00:00:00 2001 From: augustinm Date: Thu, 10 Oct 2024 09:22:51 +0200 Subject: [PATCH 6/7] update documentation --- aprofiles/cli/apro.py | 5 +- aprofiles/cli/utils/l2b.py | 18 ++---- docs/cli.md | 109 +++++++++++++++++++------------------ 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/aprofiles/cli/apro.py b/aprofiles/cli/apro.py index 35800f8..eb6947d 100755 --- a/aprofiles/cli/apro.py +++ b/aprofiles/cli/apro.py @@ -200,6 +200,9 @@ def l2b( path_out: Path = typer.Option( "data/l2b", exists=True, writable=True, help="๐Ÿ“‚ Base path for output data." ), + time_steps: int = typer.Option( + 12, help="๐Ÿ”‚ Number of most recent time steps to be processed." + ), progress_bar: bool = typer.Option(True, help="โŒ› Show progress bar.") ): """ @@ -212,7 +215,7 @@ def l2b( today = datetime.today() path_in = Path(path_in, today.strftime('%Y'), today.strftime('%m'), today.strftime('%d')) - utils.l2b.make_files(path_in, path_out, progress_bar) + utils.l2b.make_files(path_in, path_out, time_steps, progress_bar) if __name__ == "__main__": app() diff --git a/aprofiles/cli/utils/l2b.py b/aprofiles/cli/utils/l2b.py index 7a7ca64..b7c7286 100644 --- a/aprofiles/cli/utils/l2b.py +++ b/aprofiles/cli/utils/l2b.py @@ -1,5 +1,4 @@ #!/usr/bin/env python - import os import sys from pathlib import Path @@ -10,29 +9,24 @@ import pandas as pd from rich.progress import track -def make_files(path_in: Path, path_out: Path, progress_bar: bool) -> None: +def make_files(path_in: Path, path_out: Path, time_steps: int, progress_bar: bool) -> None: # list all AP files in path_in - files = glob(f"{path_in}/AP*nc") + files = list(Path(path_in).glob("AP*nc")) for f in track(files, description=f"Reading AP files", disable=not progress_bar): - ds = xr.open_dataset(f, decode_times=True, chunks=-1).load() + ds = xr.open_dataset(f, decode_times=True, chunks=-1) # get unique id and extract yyyymmdd from first time step unique_id = f"{ds.attrs['wigos_station_id']}_{ds.attrs['instrument_id']}" yyyymmdd = str(ds.time.data[0].astype('M8[D]')).replace('-','') - ntimes = ds.time.size - if ntimes < 60: - myrange = range(ntimes) - else: - myrange = range(ntimes-12, ntimes) + # we just work with n latest time steps + start_idx = max(0, ds.time.size - time_steps) - for i in myrange: + for i in range(start_idx, ds.time.size): ds1t = ds.isel(time=i) mmhh = pd.to_datetime(ds1t.time.data).strftime('%H%M') file_name = Path(path_out, f"L2B_{unique_id}{yyyymmdd}{mmhh}.nc") ds1t.to_netcdf('out.nc') os.rename('out.nc',file_name) - - diff --git a/docs/cli.md b/docs/cli.md index 7a3a696..f5c221d 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -35,18 +35,18 @@ poetry install --extras cli ``` bash apro --help - - Usage: apro [OPTIONS] COMMAND [ARGS]... - -โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ --install-completion Install completion for the current shell. โ”‚ -โ”‚ --show-completion Show completion for the current shell, to copy it or customize the installation. โ”‚ -โ”‚ --help Show this message and exit. โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ -โ•ญโ”€ Commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ l2b make E-PROFILE L2b files out of AP files โ”‚ -โ”‚ run run aprofiles standard workflow for given dates and specific instruments types โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ + + Usage: apro [OPTIONS] COMMAND [ARGS]... + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --install-completion Install completion for the current shell. โ”‚ +โ”‚ --show-completion Show completion for the current shell, to copy it or customize the installation. โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ•ญโ”€ Commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ l2b make E-PROFILE L2b files out of AP files โ”‚ +โ”‚ run run aprofiles standard workflow for given dates and specific instruments types โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` @@ -54,36 +54,38 @@ apro --help ``` bash apro run --help - - Usage: apro run [OPTIONS] - - run aprofiles standard workflow for given dates and specific instruments types - see some examples [here](https://augustinmortier.github.io/a-profiles/cli/) - -โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ --date [%Y-%m-%d] ๐Ÿ“… Processing date. โ”‚ -โ”‚ --from [%Y-%m-%d] ๐Ÿ“… Initial date. [default: None] โ”‚ -โ”‚ --to [%Y-%m-%d] ๐Ÿ“… Ending date. [default: (Today's date)] โ”‚ -โ”‚ --today --no-today ๐Ÿ•‘ Process today's data. [default: no-today] โ”‚ -โ”‚ --yesterday --no-yesterday ๐Ÿ•™ Process yesterday's data. [default: no-yesterday] โ”‚ -โ”‚ --instruments-type [CHM15k|Mini-MPL|CL61] ๐Ÿ“— List of specific instruments to be processed. โ”‚ -โ”‚ [default: CHM15k, Mini-MPL] โ”‚ -โ”‚ --multiprocessing --no-multiprocessing ๐Ÿš€ Use multiprocessing mode. โ”‚ -โ”‚ [default: no-multiprocessing] โ”‚ -โ”‚ --workers INTEGER RANGE [x>=1] ๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode is โ”‚ -โ”‚ enabled). โ”‚ -โ”‚ [env var: NSLOTS] โ”‚ -โ”‚ [default: 2] โ”‚ -โ”‚ --path-in PATH ๐Ÿ“‚ Base path for input data. [default: data/e-profile] โ”‚ -โ”‚ --path-out PATH ๐Ÿ“‚ Base path for output data. [default: data/v-profiles] โ”‚ -โ”‚ --apriori-cfg PATH ๐Ÿ“‚ Base path for a priori config file. [default: config] โ”‚ -โ”‚ --update-data --no-update-data ๐Ÿ“ˆ Update data. [default: update-data] โ”‚ -โ”‚ --update-calendar --no-update-calendar ๐Ÿ—“๏ธ Update calendar. [default: update-calendar] โ”‚ -โ”‚ --update-map --no-update-map ๐Ÿ—บ๏ธ Update map. [default: update-map] โ”‚ -โ”‚ --update-climatology --no-update-climatology โ†ช๏ธ Update climatology. [default: update-climatology] โ”‚ -โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ -โ”‚ --help Show this message and exit. โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ + + Usage: apro run [OPTIONS] + + run aprofiles standard workflow for given dates and specific instruments types + see some examples [here](https://augustinmortier.github.io/a-profiles/cli/) + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --date [%Y-%m-%d] ๐Ÿ“… Processing date. โ”‚ +โ”‚ --from [%Y-%m-%d] ๐Ÿ“… Initial date. [default: None] โ”‚ +โ”‚ --to [%Y-%m-%d] ๐Ÿ“… Ending date. [default: (Today's date)] โ”‚ +โ”‚ --today --no-today ๐Ÿ•‘ Process today's data. [default: no-today] โ”‚ +โ”‚ --yesterday --no-yesterday ๐Ÿ•™ Process yesterday's data. [default: no-yesterday] โ”‚ +โ”‚ --instruments-type [CHM15k|Mini-MPL|CL61] ๐Ÿ“— List of specific instruments to be processed. โ”‚ +โ”‚ [default: CHM15k, Mini-MPL] โ”‚ +โ”‚ --multiprocessing --no-multiprocessing ๐Ÿš€ Use multiprocessing mode. โ”‚ +โ”‚ [default: no-multiprocessing] โ”‚ +โ”‚ --workers INTEGER RANGE [x>=1] ๐Ÿ‘ท Number of workers (NSLOTS, if multiprocessing mode โ”‚ +โ”‚ is enabled). โ”‚ +โ”‚ [env var: NSLOTS] โ”‚ +โ”‚ [default: 2] โ”‚ +โ”‚ --path-in PATH ๐Ÿ“‚ Base path for input data. [default: data/e-profile] โ”‚ +โ”‚ --path-out PATH ๐Ÿ“‚ Base path for output data. โ”‚ +โ”‚ [default: data/v-profiles] โ”‚ +โ”‚ --apriori-cfg PATH ๐Ÿ“‚ Base path for a priori config file. โ”‚ +โ”‚ [default: config] โ”‚ +โ”‚ --update-data --no-update-data ๐Ÿ“ˆ Update data. [default: update-data] โ”‚ +โ”‚ --update-calendar --no-update-calendar ๐Ÿ—“๏ธ Update calendar. [default: update-calendar] โ”‚ +โ”‚ --update-map --no-update-map ๐Ÿ—บ๏ธ Update map. [default: update-map] โ”‚ +โ”‚ --update-climatology --no-update-climatology โ†ช๏ธ Update climatology. [default: update-climatology] โ”‚ +โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` #### Examples @@ -133,17 +135,18 @@ apro run --today --yesterday --multiprocessing ``` bash apro l2b --help - - Usage: apro l2b [OPTIONS] - - make E-PROFILE L2b files out of AP files - -โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ --path-in PATH ๐Ÿ“‚ Base path for input data. [default: data/v-profiles] โ”‚ -โ”‚ --path-out PATH ๐Ÿ“‚ Base path for output data. [default: data/l2b] โ”‚ -โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ -โ”‚ --help Show this message and exit. โ”‚ -โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ + + Usage: apro l2b [OPTIONS] + + make E-PROFILE L2b files out of AP files + +โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ --path-in PATH ๐Ÿ“‚ Base path for input data. [default: data/v-profiles] โ”‚ +โ”‚ --path-out PATH ๐Ÿ“‚ Base path for output data. [default: data/l2b] โ”‚ +โ”‚ --time-steps INTEGER ๐Ÿ”‚ Number of most recent time steps to be processed. [default: 12] โ”‚ +โ”‚ --progress-bar --no-progress-bar โŒ› Show progress bar. [default: progress-bar] โ”‚ +โ”‚ --help Show this message and exit. โ”‚ +โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` #### Examples From 85233f1b169ccf36c1957cd3f6279d71fe9f61ab Mon Sep 17 00:00:00 2001 From: augustinm Date: Thu, 10 Oct 2024 09:25:11 +0200 Subject: [PATCH 7/7] update documentation --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 0146cf2..c47a5ba 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,7 +7,7 @@ Oct 10, 2024 - revisit CLI: two commands - `apro run` (formerly `aprocess`: run standard workflow) - - `apro l2b` (creates L2b files out of AP files) + - `apro l2b` (creates L2B files out of AP files) ## 0.9.7 Oct 3, 2024