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