Module: data

This is a module that consolidates functions for processing numerical array data.

Methods

(static) area(bbox, width, height) → {DataObject}

Returns the area per pixel on the actual Earth's surface.The unit is [m^2]. Assuming the Earth as a rotational ellipsoid with an equatorial radius of 6,378,137 meters (WGS84) and a flattening of 1/298.257223563 (WGS84), calculate the area of each pixel when projected onto the ellipsoid with a height of 0 meters. If the size of a pixel exceeds 0.02 degrees of latitude or longitude, it is subdivided recursively until its size is 0.02 degrees or less.

It only supports geographic coordinates (EPSG:4326) and does not support regions such as the North Pole (EPSG:3995) and the South Pole (EPSG:3031).
Parameters:
Name Type Description
bbox BboxObject Latitude and longitude range in Geographic Coordinate System (EPSG:4326)
width number width (in pixels)
height number height (number of pixels)
See:
Returns:
Returns a DataObject with values representing the area per pixel [m^2]
Type
DataObject

(static) csv(data) → {string}

Convert data into a string in CSV (Comma-Separated Values) format. By separately creating a function to enable downloading as a text file, it is possible to build a feature that allows downloading a CSV file.
Parameters:
Name Type Description
data DataObject Data to be converted to CSV
See:
Returns:
CSV formatted string
Type
string

(static) globalStat(data) → {Object}

Calculate statistical values of the data by considering the differences in pixel area based on the WGS84 rotating ellipsoid obtained from module:data.area. Pixels with NaN values are excluded from the count.

It only supports geographic coordinates (EPSG:4326) and does not support regions such as the North Pole (EPSG:3995) and the South Pole (EPSG:3031).
Parameters:
Name Type Description
data DataObject Data for which statistical values are calculated
See:
Returns:
Returns an object containing the number of valid pixels, minimum value, maximum value, and average value as properties.
Type
Object

(static) stat(data) → {Object}

Calculate the statistical values of the data. Note that this calculation does not take into account the differences in area per pixel on the actual Earth's surface. If the latitude and longitude range is sufficiently narrow so that differences in area per pixel can be ignored, this simple calculation will not be a problem; however, for a strict evaluation of data across a wide latitude and longitude range, where differences in area per pixel exist, please use module:data.globalStat.
Parameters:
Name Type Description
data DataObject Data for which statistical values are calculated
See:
Returns:
Returns an object containing the number of valid pixels, minimum value, maximum value, average value, median, and standard deviation as properties.
Type
Object