geolith_dataset_builder/cli.rs
1//! The dataset subcommand surface.
2//!
3//! The engine verbs (`areas`, `normals`, `values`, `build`, `inspect`,
4//! `downloads`) and the operator verbs (`stage`, `verify`, `status`, `keys`)
5//! of `geolith dataset`, with their flags. Moved out of `src/cli.rs` so the
6//! module owns its own command tree; `src/cli.rs` re-exports them.
7
8use std::path::PathBuf;
9
10use clap::{Args, Parser, Subcommand};
11
12use crate::downloads::GeoParquetVersion;
13
14/// Build a raster dataset: district areas, normals and per-period files.
15#[derive(Debug, Parser)]
16#[command(
17 name = "geolith dataset",
18 about = "raster dataset → district areas, normals, numbers and map layer",
19 version
20)]
21pub struct DatasetArgs {
22 /// An optional JSON deployment settings file (else `GEOLITH_CONFIG`; none
23 /// by default): the object store, the publish URLs, the sources and the
24 /// alerts. The process environment and the `.env` file (`GEOLITH_ENV_FILE`,
25 /// else `./.env`) win over it. Give it before the step: the steps `normals`
26 /// and `values` take their own `--config`, the dataset config.
27 #[arg(long, value_name = "FILE")]
28 pub config: Option<PathBuf>,
29
30 /// The dataset step to run.
31 #[command(subcommand)]
32 pub action: DatasetAction,
33}
34
35/// A step of the raster dataset builder.
36#[non_exhaustive]
37#[derive(Debug, Subcommand)]
38pub enum DatasetAction {
39 /// Cut district areas from Overture divisions.
40 Areas(AreasArgs),
41 /// Compute the per-district normals of a baseline.
42 Normals(NormalsArgs),
43 /// Build the numbers and map layer of every period.
44 Build(BuildArgs),
45 /// Compute the area values of one raster into its values cache file.
46 Values(ValuesArgs),
47 /// Print a raster's layout and whether each read path decodes it.
48 Inspect(InspectArgs),
49 /// Write or check the Parquet and `GeoParquet` downloads of a stage.
50 Downloads(DownloadsArgs),
51 /// Stage an engine build as the upload-ready tree of object keys.
52 Stage(StageArgs),
53 /// Check a stage before it may be uploaded.
54 Verify(VerifyArgs),
55 /// Print the state of the newest staged build.
56 Status(StatusArgs),
57 /// Print the object keys an upload of a stage would write, from local files.
58 Keys(KeysArgs),
59 /// Upload a stage to the bucket, never overwriting a dated key.
60 Upload(UploadArgs),
61 /// Publish a stage's pointer, the only overwritten key.
62 Publish(PublishArgs),
63 /// Write the CHIRPS download lists from the host's directory listings.
64 Lists(ListsArgs),
65 /// Download a dataset's sources: CHIRPS rasters, boundaries, Overture.
66 Fetch(FetchArgs),
67 /// Stream the NDVI baseline one file at a time into the values cache.
68 BaselinePass(BaselinePassArgs),
69 /// The Copernicus NDVI dekads: the catalogue lists and the pixel window.
70 Cdse(CdseArgs),
71 /// The official LGD lists the district crosswalk reads.
72 Lgd(LgdArgs),
73 /// Build the India district crosswalk (Overture ids ↔ LGD codes).
74 Crosswalk(CrosswalkArgs),
75 /// Print the inputs record of an engine build, or the newest period.
76 Inputs(InputsArgs),
77 /// Download, build and verify one dataset, then stop before upload.
78 Run(RunArgs),
79 /// Delete the source rasters and stages the pipeline no longer reads.
80 Prune(PruneArgs),
81 /// Check the new period of a stage against its slot history.
82 Bounds(BoundsArgs),
83 /// Write the measured per-slot table the bounds gate reads.
84 Slots(SlotsArgs),
85 /// Compare a stage's values with GDAL, the optional external oracle.
86 Accuracy(AccuracyArgs),
87 /// Install, inspect or remove the daily refresh job.
88 Schedule(ScheduleArgs),
89 /// Decide, build and publish every published dataset, one pair at a time.
90 Refresh(RefreshArgs),
91}
92
93/// Flags of `geolith dataset downloads`.
94#[derive(Debug, Args)]
95pub struct DownloadsArgs {
96 /// The download to write, or `check`.
97 #[command(subcommand)]
98 pub action: DownloadsAction,
99}
100
101/// A step of `geolith dataset downloads`.
102#[non_exhaustive]
103#[derive(Debug, Subcommand)]
104pub enum DownloadsAction {
105 /// Write `numbers.parquet` from a build's `numbers.csv` and `index.json`.
106 Numbers(NumbersDownloadArgs),
107 /// Write `areas.parquet` (`GeoParquet` 2.0.0, `--geoparquet 1.1` for
108 /// 1.1.0) and `LICENSE.txt` from `areas.geojson`.
109 Areas(AreasDownloadArgs),
110 /// Print rows, columns, metadata keys and attribution of a Parquet file
111 /// as JSON.
112 Check(CheckDownloadArgs),
113}
114
115/// Flags of `geolith dataset downloads numbers`.
116#[derive(Debug, Args)]
117pub struct NumbersDownloadArgs {
118 /// `numbers.csv` of the build.
119 #[arg(long)]
120 pub csv: PathBuf,
121
122 /// `index.json` of the build (attribution, licence and comparison).
123 #[arg(long)]
124 pub index: PathBuf,
125
126 /// The data source URL, the `source` of the build's area JSON; written
127 /// as the `source_url` metadata.
128 #[arg(long)]
129 pub source_url: String,
130
131 /// Output `numbers.parquet` path.
132 #[arg(long)]
133 pub out: PathBuf,
134}
135
136/// Flags of `geolith dataset downloads areas`.
137#[derive(Debug, Args)]
138pub struct AreasDownloadArgs {
139 /// Areas `GeoJSON` written by `geolith dataset areas`.
140 #[arg(long)]
141 pub areas: PathBuf,
142
143 /// Overture release of the areas.
144 #[arg(long)]
145 pub release: String,
146
147 /// Country config; its attribution, licence id and licence file replace
148 /// the built-in ODbL ones.
149 #[arg(long)]
150 pub country_config: Option<PathBuf>,
151
152 /// Output directory for `areas.parquet` and `LICENSE.txt`.
153 #[arg(long)]
154 pub out: PathBuf,
155
156 /// `GeoParquet` version of `areas.parquet`: `2.0` writes the native
157 /// Parquet `GEOMETRY` logical type and per-row-group geospatial
158 /// statistics, `1.1` a plain WKB `Binary` column.
159 #[arg(long, value_enum, default_value = "2.0")]
160 pub geoparquet: GeoParquetVersion,
161}
162
163/// Flags of `geolith dataset downloads check`.
164#[derive(Debug, Args)]
165pub struct CheckDownloadArgs {
166 /// The Parquet file to read back.
167 pub file: PathBuf,
168}
169
170/// Flags of `geolith dataset areas`.
171#[derive(Debug, Args)]
172pub struct AreasArgs {
173 /// Overture release directory holding the divisions Parquet.
174 #[arg(long)]
175 pub overture: Option<PathBuf>,
176
177 /// Country config; a `shapefile` source reads `--boundaries-dir` instead
178 /// of Overture.
179 #[arg(long)]
180 pub country_config: Option<PathBuf>,
181
182 /// Directory holding the unzipped boundary files of a `shapefile`
183 /// country.
184 #[arg(long)]
185 pub boundaries_dir: Option<PathBuf>,
186
187 /// Comma-separated ISO country codes to cover, e.g. `IN`; taken from the
188 /// country config when absent.
189 #[arg(long)]
190 pub countries: Option<String>,
191
192 /// Overture division subtype used as the area unit.
193 #[arg(long, default_value = "county")]
194 pub subtype: String,
195
196 /// Survey of India outline; required when the countries include `IN`,
197 /// `PK`, `CN` or an `X*` code.
198 #[arg(long)]
199 pub india_outline: Option<PathBuf>,
200
201 /// Overture release name recorded in the outputs.
202 #[arg(long)]
203 pub release: Option<String>,
204
205 /// Maximum zoom of the areas tiles.
206 #[arg(long, default_value = "8")]
207 pub max_zoom: u8,
208
209 /// Comma-separated coded Indian regions allowed to hold no district (the
210 /// explicit allowlist of the India check; none by default).
211 #[arg(long)]
212 pub allow_districtless: Option<String>,
213
214 /// Output directory.
215 #[arg(long)]
216 pub out: PathBuf,
217}
218
219/// Flags of `geolith dataset normals`.
220#[derive(Debug, Args)]
221pub struct NormalsArgs {
222 /// Dataset config JSON.
223 #[arg(long)]
224 pub config: PathBuf,
225
226 /// Directory of source rasters.
227 #[arg(long)]
228 pub rasters: PathBuf,
229
230 /// Areas `GeoJSON` written by `geolith dataset areas`.
231 #[arg(long)]
232 pub areas: PathBuf,
233
234 /// Baseline years, `FIRST-LAST`.
235 #[arg(long, default_value = "1991-2020")]
236 pub baseline: String,
237
238 /// Comma-separated period slots, each `MM-P`.
239 #[arg(long)]
240 pub slots: String,
241
242 /// Output normals CSV path.
243 #[arg(long)]
244 pub out: PathBuf,
245
246 /// Values cache directory: each raster's area values are read from
247 /// `<dir>/<raster file stem>.values.csv` when present, else computed and
248 /// written there.
249 #[arg(long)]
250 pub cache: Option<PathBuf>,
251
252 /// Treat an area the baseline rasters never reach as excluded instead of
253 /// fatal: a country whose raster stops short of its far north (the United
254 /// States: CHIRPS ends at 50°N) declares its coverage floor in the country
255 /// config, and this flag carries that decision to the normals.
256 #[arg(long)]
257 pub allow_empty: bool,
258}
259
260/// Flags of `geolith dataset values`.
261#[derive(Debug, Args)]
262pub struct ValuesArgs {
263 /// Dataset config JSON.
264 #[arg(long)]
265 pub config: PathBuf,
266
267 /// The one source raster.
268 #[arg(long)]
269 pub raster: PathBuf,
270
271 /// Areas `GeoJSON` written by `geolith dataset areas`.
272 #[arg(long)]
273 pub areas: PathBuf,
274
275 /// Values cache directory; the file written is
276 /// `<dir>/<raster file stem>.values.csv`.
277 #[arg(long)]
278 pub cache: PathBuf,
279}
280
281/// Flags of `geolith dataset inspect`.
282#[derive(Debug, Args)]
283pub struct InspectArgs {
284 /// The raster (`GeoTIFF` or COG) to inspect.
285 pub file: PathBuf,
286
287 /// EPSG code of the grid, for files without geokeys.
288 #[arg(long)]
289 pub crs_epsg: Option<u32>,
290}
291
292/// Flags of `geolith dataset build`.
293#[derive(Debug, Args)]
294pub struct BuildArgs {
295 /// Dataset config JSON.
296 #[arg(long)]
297 pub config: PathBuf,
298
299 /// Directory of source rasters.
300 #[arg(long)]
301 pub rasters: PathBuf,
302
303 /// Areas `GeoJSON` written by `geolith dataset areas`.
304 #[arg(long)]
305 pub areas: PathBuf,
306
307 /// Normals CSV written by `geolith dataset normals`.
308 #[arg(long)]
309 pub normals: Option<PathBuf>,
310
311 /// Survey of India outline that clips the map layer over India.
312 #[arg(long)]
313 pub india_outline: Option<PathBuf>,
314
315 /// CSV of the published districts (`region_code,district,capital`);
316 /// fills `index.json` `published`.
317 #[arg(long)]
318 pub published: Option<PathBuf>,
319
320 /// District crosswalk CSV (Overture id ↔ LGD code); fills `lgd_code`
321 /// and `approximate`.
322 #[arg(long)]
323 pub crosswalk: Option<PathBuf>,
324
325 /// Periods with a map layer, the latest included (1 to 12); the
326 /// config's `layer_periods` (else 1) when absent.
327 #[arg(long)]
328 pub layer_periods: Option<u8>,
329
330 /// Country config; its dataset limits and boundary attribution fill what
331 /// the flags leave out.
332 #[arg(long)]
333 pub country_config: Option<PathBuf>,
334
335 /// Map bounds `min_lon,min_lat,max_lon,max_lat`; wins over the country
336 /// config.
337 #[arg(long)]
338 pub bounds: Option<String>,
339
340 /// Areas covered below this percentage get no page for this dataset;
341 /// wins over the country config.
342 #[arg(long)]
343 pub min_coverage: Option<f64>,
344
345 /// Acknowledgement of the area codes, printed by every page; wins over
346 /// the country config.
347 #[arg(long)]
348 pub codes_attribution: Option<String>,
349
350 /// Output directory.
351 #[arg(long)]
352 pub out: PathBuf,
353}
354
355/// Flags of `geolith dataset stage`.
356#[derive(Debug, Args)]
357pub struct StageArgs {
358 /// The engine build directory to stage.
359 pub engine_build_dir: PathBuf,
360
361 /// Dataset id (`DATASET`, else `rainfall`).
362 #[arg(long)]
363 pub dataset: Option<String>,
364
365 /// ISO country code (`COUNTRY`, else `in`).
366 #[arg(long)]
367 pub country: Option<String>,
368}
369
370/// Flags of `geolith dataset verify`.
371#[derive(Debug, Args)]
372pub struct VerifyArgs {
373 /// Build id; the newest complete stage when absent.
374 pub build_id: Option<String>,
375
376 /// Dataset id (`DATASET`, else `rainfall`).
377 #[arg(long)]
378 pub dataset: Option<String>,
379
380 /// ISO country code (`COUNTRY`, else `in`).
381 #[arg(long)]
382 pub country: Option<String>,
383}
384
385/// Flags of `geolith dataset status`.
386#[derive(Debug, Args)]
387pub struct StatusArgs {
388 /// Dataset id (`DATASET`, else `rainfall`).
389 #[arg(long)]
390 pub dataset: Option<String>,
391
392 /// ISO country code (`COUNTRY`, else `in`).
393 #[arg(long)]
394 pub country: Option<String>,
395}
396
397/// Flags of `geolith dataset keys`.
398#[derive(Debug, Args)]
399pub struct KeysArgs {
400 /// Build id of the stage.
401 pub build_id: String,
402
403 /// Dataset id (`DATASET`, else `rainfall`).
404 #[arg(long)]
405 pub dataset: Option<String>,
406
407 /// ISO country code (`COUNTRY`, else `in`).
408 #[arg(long)]
409 pub country: Option<String>,
410}
411
412/// Flags of `geolith dataset upload`.
413#[derive(Debug, Args)]
414pub struct UploadArgs {
415 /// Build id of the stage.
416 pub build_id: String,
417
418 /// Print the plan; write nothing.
419 #[arg(long)]
420 pub dry_run: bool,
421
422 /// The bucket to write to: only `storage.bucket` is accepted, so the flag
423 /// confirms it.
424 #[arg(long)]
425 pub bucket: Option<String>,
426
427 /// Dataset id (`DATASET`, else `rainfall`).
428 #[arg(long)]
429 pub dataset: Option<String>,
430
431 /// ISO country code (`COUNTRY`, else `in`).
432 #[arg(long)]
433 pub country: Option<String>,
434}
435
436/// Flags of `geolith dataset publish`.
437#[derive(Debug, Args)]
438pub struct PublishArgs {
439 /// Build id of the stage.
440 pub build_id: String,
441
442 /// Print the plan; write nothing.
443 #[arg(long)]
444 pub dry_run: bool,
445
446 /// The bucket to write to: only `storage.bucket` is accepted, so the flag
447 /// confirms it.
448 #[arg(long)]
449 pub bucket: Option<String>,
450
451 /// Return the pointer to a build that was live (the refresh path only).
452 #[arg(long)]
453 pub rollback: bool,
454
455 /// Dataset id (`DATASET`, else `rainfall`).
456 #[arg(long)]
457 pub dataset: Option<String>,
458
459 /// ISO country code (`COUNTRY`, else `in`).
460 #[arg(long)]
461 pub country: Option<String>,
462}
463
464/// Flags of `geolith dataset lists`.
465#[derive(Debug, Args)]
466pub struct ListsArgs {
467 /// The publisher's final-pentads listing (HTML or a plain list of names).
468 #[arg(long)]
469 pub listing_final: Option<std::path::PathBuf>,
470
471 /// The publisher's preliminary-pentads listing.
472 #[arg(long)]
473 pub listing_prelim: Option<std::path::PathBuf>,
474
475 /// First day of the season, `MM-DD` on a pentad start.
476 #[arg(long)]
477 pub season_start: Option<String>,
478
479 /// Baseline years, `FIRST-LAST`; `1991-2020` when absent.
480 #[arg(long)]
481 pub baseline: Option<String>,
482
483 /// Output directory of `series.txt`, `season.txt` and `baseline.txt`.
484 #[arg(long)]
485 pub out: Option<std::path::PathBuf>,
486}
487
488/// Flags of `geolith dataset fetch`.
489#[derive(Debug, Args)]
490pub struct FetchArgs {
491 /// Also download the baseline years (slow: 2160 files).
492 #[arg(long)]
493 pub baseline: bool,
494
495 /// Download the country's boundary archives and unzip them instead.
496 #[arg(long)]
497 pub boundaries: bool,
498
499 /// Raster mode of the NDVI dekads: `clip` (the country window, the
500 /// default) or `full` (the whole file).
501 #[arg(long)]
502 pub mode: Option<String>,
503
504 /// ISO country code (`COUNTRY`, else `in`).
505 #[arg(long, default_value = "in")]
506 pub country: String,
507
508 /// Dataset id (`DATASET`, else `rainfall`).
509 #[arg(long)]
510 pub dataset: Option<String>,
511}
512
513/// Flags of `geolith dataset baseline-pass`.
514#[derive(Debug, Args)]
515pub struct BaselinePassArgs {
516 /// Raster mode of the baseline files: `clip` (the country window, the
517 /// default, through GDAL) or `full` (the whole file, in Rust).
518 #[arg(long)]
519 pub mode: Option<String>,
520
521 /// ISO country code (`COUNTRY`, else `in`).
522 #[arg(long, default_value = "in")]
523 pub country: String,
524
525 /// Dataset id (`DATASET`, else `rainfall`).
526 #[arg(long)]
527 pub dataset: Option<String>,
528
529 /// Free-space floor in GB, kept free before each file (`DATASETS_MIN_FREE_GB`,
530 /// else 100).
531 #[arg(long)]
532 pub min_free_gb: Option<u64>,
533}
534
535/// Flags of `geolith dataset cdse`.
536#[derive(Debug, Args)]
537pub struct CdseArgs {
538 /// The CDSE step to run.
539 #[command(subcommand)]
540 pub action: CdseAction,
541}
542
543/// A step of `geolith dataset cdse`.
544#[non_exhaustive]
545#[derive(Debug, Subcommand)]
546pub enum CdseAction {
547 /// List the NDVI dekads the STAC catalogue holds, oldest first.
548 List(CdseListArgs),
549 /// Print the S3 prefixes of the dekads the catalogue lacks.
550 Missing(CdseMissingArgs),
551 /// Add the dekads of a direct S3 listing to a catalogue list.
552 Merge(CdseMergeArgs),
553 /// Print `<key> <bytes>` of every object under each prefix, from S3.
554 Ls(CdseLsArgs),
555 /// Print the range of the current dekad and the 12 before it.
556 SeriesRange(CdseSeriesRangeArgs),
557 /// Print the pixel window of a country's areas on the NDVI grid.
558 Window(CdseWindowArgs),
559}
560
561/// Flags of `geolith dataset cdse list`.
562#[derive(Debug, Args)]
563pub struct CdseListArgs {
564 /// First day of the range.
565 #[arg(long)]
566 pub from: String,
567
568 /// Last day of the range.
569 #[arg(long)]
570 pub to: String,
571
572 /// STAC root (`CDSE_STAC`, else the public catalogue).
573 #[arg(long)]
574 pub stac: Option<String>,
575}
576
577/// Flags of `geolith dataset cdse missing`.
578#[derive(Debug, Args)]
579pub struct CdseMissingArgs {
580 /// The list `cdse list` wrote.
581 #[arg(long)]
582 pub list: std::path::PathBuf,
583
584 /// First day of the range.
585 #[arg(long)]
586 pub from: String,
587
588 /// Last day of the range.
589 #[arg(long)]
590 pub to: String,
591
592 /// Today (`CDSE_TODAY`, else UTC today).
593 #[arg(long)]
594 pub today: Option<String>,
595}
596
597/// Flags of `geolith dataset cdse merge`.
598#[derive(Debug, Args)]
599pub struct CdseMergeArgs {
600 /// The list `cdse list` wrote.
601 #[arg(long)]
602 pub list: std::path::PathBuf,
603
604 /// The direct S3 listing (`<key> <bytes>` lines).
605 #[arg(long)]
606 pub s3: std::path::PathBuf,
607}
608
609/// Flags of `geolith dataset cdse ls`.
610#[derive(Debug, Args)]
611pub struct CdseLsArgs {
612 /// The prefixes to list, one per line, relative to `eodata/`.
613 #[arg(long)]
614 pub prefixes: std::path::PathBuf,
615}
616
617/// Flags of `geolith dataset cdse series-range`.
618#[derive(Debug, Args)]
619pub struct CdseSeriesRangeArgs {
620 /// Today (`CDSE_TODAY`, else UTC today).
621 #[arg(long)]
622 pub today: Option<String>,
623}
624
625/// Flags of `geolith dataset cdse window`.
626#[derive(Debug, Args)]
627pub struct CdseWindowArgs {
628 /// Areas `GeoJSON` written by `geolith dataset areas`.
629 #[arg(long)]
630 pub areas: std::path::PathBuf,
631
632 /// ISO country code of the areas (`IN`).
633 #[arg(long, default_value = "IN")]
634 pub country: String,
635
636 /// Survey of India outline; required for `IN`.
637 #[arg(long)]
638 pub outline: Option<std::path::PathBuf>,
639
640 /// `<x0>,<y0>,<px>,<py>,<width>,<height>`; the NDVI grid when absent.
641 #[arg(long)]
642 pub grid: Option<String>,
643
644 /// Block size the window is snapped to.
645 #[arg(long, default_value = "512")]
646 pub block: u32,
647}
648
649/// Flags of `geolith dataset lgd`.
650#[derive(Debug, Args)]
651pub struct LgdArgs {
652 /// The LGD step to run.
653 #[command(subcommand)]
654 pub action: LgdAction,
655
656 /// LGD directory (`LGD_DIR`, else `$DATA_ROOT/datasets/lgd`).
657 #[arg(long, global = true)]
658 pub dir: Option<std::path::PathBuf>,
659}
660
661/// A step of `geolith dataset lgd`.
662#[non_exhaustive]
663#[derive(Debug, clap::Subcommand)]
664pub enum LgdAction {
665 /// Parse the LGD state page into `states.csv`.
666 States(LgdStatesArgs),
667 /// Check the owner-saved district list and record it.
668 Districts(LgdDistrictsArgs),
669}
670
671/// Flags of `geolith dataset lgd states`.
672#[derive(Debug, Args)]
673pub struct LgdStatesArgs {
674 /// Refetch and rewrite `states.csv` even when it exists.
675 #[arg(long)]
676 pub force: bool,
677
678 /// Parse a saved copy of the page instead of fetching it.
679 #[arg(long)]
680 pub html: Option<std::path::PathBuf>,
681}
682
683/// Flags of `geolith dataset lgd districts`.
684#[derive(Debug, Args)]
685pub struct LgdDistrictsArgs {
686 /// The time the owner downloaded the list, ISO 8601 with an offset.
687 #[arg(long)]
688 pub downloaded_at: Option<String>,
689}
690
691/// Flags of `geolith dataset crosswalk`.
692#[derive(Debug, Args)]
693pub struct CrosswalkArgs {
694 /// Areas GeoJSON (`$DATA_ROOT/datasets/boundaries/in/<release>/areas.geojson`).
695 #[arg(long)]
696 pub areas: Option<std::path::PathBuf>,
697
698 /// LGD directory holding `states.csv` and `districts.csv`.
699 #[arg(long)]
700 pub lgd: Option<std::path::PathBuf>,
701
702 /// Reviewed aliases CSV.
703 #[arg(long)]
704 pub aliases: Option<std::path::PathBuf>,
705
706 /// Output crosswalk CSV.
707 #[arg(long)]
708 pub out: Option<std::path::PathBuf>,
709
710 /// Output summary markdown.
711 #[arg(long)]
712 pub summary: Option<std::path::PathBuf>,
713}
714
715/// Flags of `geolith dataset inputs`.
716#[derive(Debug, Args)]
717pub struct InputsArgs {
718 /// Dataset config JSON.
719 pub config: std::path::PathBuf,
720
721 /// Directory of source rasters.
722 pub src: std::path::PathBuf,
723
724 /// Print the newest period on disk instead of the record.
725 #[arg(long)]
726 pub latest: bool,
727
728 /// The engine binary the record hashes.
729 pub engine: Option<std::path::PathBuf>,
730
731 /// The published list the record hashes.
732 pub published: Option<std::path::PathBuf>,
733
734 /// The normals CSV the record hashes.
735 pub normals: Option<std::path::PathBuf>,
736
737 /// The areas GeoJSON the record hashes.
738 pub areas: Option<std::path::PathBuf>,
739
740 /// The crosswalk CSV the record hashes, when the build read one.
741 pub crosswalk: Option<std::path::PathBuf>,
742}
743
744/// Flags of `geolith dataset run`.
745#[derive(Debug, Args)]
746pub struct RunArgs {
747 /// Print what each step would do; fetch, build and write nothing.
748 #[arg(long)]
749 pub dry_run: bool,
750
751 /// Always run a new engine build, even when the inputs are unchanged.
752 #[arg(long)]
753 pub rebuild: bool,
754
755 /// Dataset id (`DATASET`, else `rainfall`).
756 #[arg(long)]
757 pub dataset: Option<String>,
758
759 /// ISO country code (`COUNTRY`, else `in`).
760 #[arg(long)]
761 pub country: Option<String>,
762}
763
764/// Flags of `geolith dataset prune`.
765#[derive(Debug, Args)]
766pub struct PruneArgs {
767 /// Print what would be deleted; delete nothing.
768 #[arg(long)]
769 pub dry_run: bool,
770}
771
772/// Flags of `geolith dataset bounds`.
773#[derive(Debug, Args)]
774pub struct BoundsArgs {
775 /// The staged build to check.
776 #[arg(long)]
777 pub build: String,
778
779 /// Dataset id (`DATASET`, else `rainfall`).
780 #[arg(long)]
781 pub dataset: Option<String>,
782
783 /// ISO country code (`COUNTRY`, else `in`).
784 #[arg(long)]
785 pub country: Option<String>,
786}
787
788/// Flags of `geolith dataset slots`.
789#[derive(Debug, Args)]
790pub struct SlotsArgs {
791 /// The values cache `geolith dataset values` filled.
792 #[arg(long)]
793 pub cache: PathBuf,
794
795 /// The table to write; the committed `<dataset>-slots[-<cc>].json` when
796 /// absent.
797 #[arg(long)]
798 pub out: Option<PathBuf>,
799
800 /// Dataset id (`DATASET`, else `rainfall`).
801 #[arg(long)]
802 pub dataset: Option<String>,
803
804 /// ISO country code (`COUNTRY`, else `in`).
805 #[arg(long)]
806 pub country: Option<String>,
807}
808
809/// Flags of `geolith dataset accuracy`.
810#[derive(Debug, Args)]
811pub struct AccuracyArgs {
812 /// The staged build to compare.
813 #[arg(long)]
814 pub build: String,
815
816 /// Dataset id (`DATASET`, else `rainfall`).
817 #[arg(long)]
818 pub dataset: Option<String>,
819
820 /// ISO country code (`COUNTRY`, else `in`).
821 #[arg(long)]
822 pub country: Option<String>,
823}
824
825/// Flags of `geolith dataset schedule`.
826#[derive(Debug, Args)]
827pub struct ScheduleArgs {
828 /// What to do with the daily refresh job.
829 #[command(subcommand)]
830 pub action: ScheduleAction,
831}
832
833/// A schedule action.
834#[non_exhaustive]
835#[derive(Debug, Subcommand)]
836pub enum ScheduleAction {
837 /// Install the binary and the daily job, and load it.
838 Install,
839 /// Print the job's state, its binary's digest and the last history lines.
840 Status,
841 /// Unload the job and remove its definition, leaving the binary.
842 Uninstall,
843}
844
845/// Flags of `geolith dataset refresh`.
846#[derive(Debug, Args)]
847pub struct RefreshArgs {
848 /// List the sources and write the history line; build, upload and publish
849 /// nothing.
850 #[arg(long)]
851 pub dry_run: bool,
852
853 /// Only this dataset (every published dataset by default).
854 #[arg(long)]
855 pub dataset: Option<String>,
856
857 /// Only this country (`COUNTRY` when set, else every country config).
858 #[arg(long)]
859 pub country: Option<String>,
860}