@oceanum/datamesh / Dataset
Defined in: packages/datamesh/src/lib/datamodel.ts:344
S
extends HttpZarr
| TempZarr
new Dataset<
S
>(dimensions
,variables
,attributes
,coordkeys
,root
):Dataset
<S
>
Defined in: packages/datamesh/src/lib/datamodel.ts:361
Record
<string
, number
>
S
extends TempZarr
? Record
<string
, DataVar
<DataType
, TempZarr
>> : Record
<string
, DataVar
<DataType
, HttpZarr
>>
Record
<string
, unknown
>
S
Dataset
<S
>
attributes:
Record
<string
,unknown
>
Defined in: packages/datamesh/src/lib/datamodel.ts:357
coordkeys:
Coordkeys
Defined in: packages/datamesh/src/lib/datamodel.ts:358
dimensions:
Record
<string
,number
>
Defined in: packages/datamesh/src/lib/datamodel.ts:353
Creates an instance of Dataset.
The dimensions of the dataset.
The data variables of the dataset.
The attributes of the dataset.
The root group of the dataset.
The coordinates map of the dataset.
root:
S
Defined in: packages/datamesh/src/lib/datamodel.ts:359
variables:
S
extendsTempZarr
?Record
<string
,DataVar
<DataType
,TempZarr
>> :Record
<string
,DataVar
<DataType
,HttpZarr
>>
Defined in: packages/datamesh/src/lib/datamodel.ts:354
asDataframe():
Promise
<Record
<string
,unknown
>[]>
Defined in: packages/datamesh/src/lib/datamodel.ts:602
Converts the dataset into a dataframe format.
Promise
<Record
<string
, unknown
>[]>
A promise that resolves to an array of records, where each record represents a row in the dataframe.
This method iterates over the data variables, retrieves their dimensions and data, and then flattens the data into a dataframe structure. Time coordinates are converted to IDO8601 format. BigInt datatypes are coerced to number.
const dataframe = await instance.asDataframe();
console.log(dataframe);
asGeojson(
geometry?
):Promise
<FeatureCollection
<Geometry
,GeoJsonProperties
>>
Defined in: packages/datamesh/src/lib/datamodel.ts:653
Converts the dataset into a GeoJSON Feature.
Geometry
Optional GeoJSON geometry to apply to all records, otherwise geometry column is required. Will override geometry column if present.
Promise
<FeatureCollection
<Geometry
, GeoJsonProperties
>>
A promise that resolves to an array of records, where each record represents a row in the dataframe.
Will throw an error if no geometry is found in data or as a parameter
This method iterates over the data variables, retrieves their dimensions and data, and then flattens the data into a dataframe structure.
const dataframe = await instance.asDataframe();
console.log(dataframe);
assign(
varid
,dims
,data
,attrs?
,dtype?
,chunks?
):Promise
<void
>
Defined in: packages/datamesh/src/lib/datamodel.ts:699
Asynchronously assigns data to a variable in the dataset.
string
The identifier for the variable.
string
[]
An array of dimension names corresponding to the data.
The data to be assigned, which can be a multi-dimensional array.
Record
<string
, unknown
>
Optional. A record of attributes to be associated with the variable.
DataType
Optional. The data type of the data.
number
[]
Optional. An array specifying the chunk sizes for the data.
Promise
<void
>
A promise that resolves when the data has been successfully assigned.
Will throw an error if the shape of the data does not match the provided dimensions.
Will throw an error if an existing dimension size does not match the new data.
static
fromArrow(data
,coordkeys
):Promise
<Dataset
<TempZarr
>>
Defined in: packages/datamesh/src/lib/datamodel.ts:443
Table
Promise
<Dataset
<TempZarr
>>
static
fromGeojson(geojson
,coordkeys?
):Promise
<Dataset
<TempZarr
>>
Defined in: packages/datamesh/src/lib/datamodel.ts:483
FeatureCollection <Geometry , GeoJsonProperties > |
Feature <Geometry , GeoJsonProperties > |
Promise
<Dataset
<TempZarr
>>
static
init(datasource
,coordkeys?
):Promise
<Dataset
<TempZarr
>>
Defined in: packages/datamesh/src/lib/datamodel.ts:555
Initializes an in memory Dataset instance from a data object.
An object containing id, dimensions, data variables, and attributes.
Promise
<Dataset
<TempZarr
>>
static
zarr(url
,authHeaders
,options
):Promise
<Dataset
<HttpZarr
>>
Defined in: packages/datamesh/src/lib/datamodel.ts:390
Creates a Dataset instance from a Zarr store.
string
The URL of the datamesh gateway.
Record
<string
, string
>
The authentication headers.
ZarrOptions
= {}
Promise
<Dataset
<HttpZarr
>>
A promise that resolves to a Dataset instance.