GridsFromDirectory

class GridsFromDirectory @JvmOverloads constructor(directory: String, variable: String? = null) : GridSnapshots

GridSnapshots read at construction from a directory of NetCDF or GRIB files sharing the same variable and latitude/longitude grid. Each file must hold a {time, latitude, longitude} variable, with its dimensions in any order; axes are sorted ascending, longitudes beyond 180° (e.g., stored in [0, 360)) are moved to [-180, 180], and missing values become Double.NaN. Grids crossing the antimeridian are not supported, as they would split into two blocks with a gap in between. Files with no time axis are timed by their reference time axis, if any, with a warning: for forecasts, the reference time precedes the time the data are valid at by their lead time. When files share an instant, the first file in lexicographic order wins.

Parameters

directory

the directory holding the data files, among the classpath resources or, if not there, on the file system.

variable

the name of the variable inside the files (e.g., dis24), auto-detected when null.

Throws

if the directory does not exist or has no data files, if the variable is missing or ambiguous, or if the files disagree on their grid or variable.

Constructors

Link copied to clipboard
constructor(directory: String, variable: String? = null)

Properties

Link copied to clipboard
open override val instants: List<Instant>

The instants of the grids, strictly ascending.

Functions

Link copied to clipboard
open override fun grid(index: Int): RasterGrid

The grid at the instant with the given index in instants.