Geotessera library for OCaml
1(* {1 Tessera bindings for OCaml}
2
3 Access and use the Tessera bindings directly in OCaml. *)
4
5module Bbox : sig
6 type t
7 (** A bounding box *)
8
9 val v : min_lon:float -> min_lat:float -> max_lon:float -> max_lat:float -> t
10 (** Construct a bounding box *)
11end
12
13type point = { lat : float; lon : float }
14(** Points *)
15
16type 'a env =
17 < fs : Eio.Fs.dir_ty Eio.Path.t
18 ; process_mgr : [> `Generic ] Eio.Process.mgr_ty Eio.Process.mgr
19 ; net : [> `Generic ] Eio.Net.ty Eio.Net.t
20 ; .. >
21 as
22 'a
23(** The required environment for {! fetch}ing embeddings. Filesystem access is
24 needed for caching the downloads, network access for fetching the downloads
25 and the process manager is needed for running git commands. *)
26
27type embedding = (int, Bigarray.int8_signed_elt) Nx.t
28(** Quantised embeddings *)
29
30type scales = (float, Bigarray.float32_elt) Nx.t
31(** Scales for embeddings *)
32
33val fetch :
34 _ env ->
35 year:int ->
36 Bbox.t ->
37 ((int * (float, Bigarray.float64_elt) Nx.t)
38 * point
39 * Eio.Fs.dir_ty Eio.Path.t
40 * (embedding * scales))
41 list
42(** [fetch env ~year bbox] returns a list of
43 [((crs, transform), centre, landmask_path, scaled_embeddings)] for the tiles
44 available in [bbox] for [year].
45
46 Note that the [transformation] is returned in GDAL format. *)
47
48val scale : embedding * scales -> (float, Bigarray.float32_elt) Nx.t
49(** Scale up the embeddings *)