I only take the wind field data in the Beijing area, how should I render it?
This is how my data is parsed:
`request.onload = function () {
var arrayToMap = function (array) {
return array.reduce(function (map, object) {
map[object.name] = object;
return map;
}, {});
}
var NetCDF = new netcdfjs(request.response);
data = {};
var dimensions = arrayToMap(NetCDF.dimensions);
data.dimensions = {};
data.dimensions.lon = dimensions['lon'].size; // 经度个数
data.dimensions.lat = dimensions['lat'].size; // 纬度个数
// dimensions['lev'].size
data.dimensions.lev = dimensions['height'].size; // 维度(时间、经度、纬度)例:time(个数)
var variables = arrayToMap(NetCDF.variables);
var uAttributes = arrayToMap(variables['uwind'].attributes); // 纬向风属性信息
var vAttributes = arrayToMap(variables['vwind'].attributes); // 经向风属性信息(描述:)
data.lon = {};
data.lon.array = new Float32Array(NetCDF.getDataVariable('lon').flat());
data.lon.min = Math.min(...data.lon.array);
data.lon.max = Math.max(...data.lon.array);
data.lat = {};
data.lat.array = new Float32Array(NetCDF.getDataVariable('lat').flat());
data.lat.min = Math.min(...data.lat.array);
data.lat.max = Math.max(...data.lat.array);
data.lev = {};
let firstLev = [NetCDF.getDataVariable('height')[0]];
data.lev.array = new Float32Array(firstLev.flat());
data.lev.min = Math.min(...data.lev.array);
data.lev.max = Math.max(...data.lev.array);
data.U = {};
let beforeU4W = NetCDF.getDataVariable('uwind').slice(0, 40000);
data.U.array = new Float32Array(beforeU4W.flat());
console.log('[ data.U.array ] >', NetCDF.getDataVariable('uwind'));
data.U.min = Math.min(...data.U.array);
data.U.max = Math.max(...data.U.array);
data.V = {};
let beforeV4W = NetCDF.getDataVariable('vwind').slice(0, 40000);
data.V.array = new Float32Array(beforeV4W.flat());
data.V.min = Math.min(...data.V.array);
data.V.max = Math.max(...data.V.array);
resolve(data);
};`
I only take the wind field data in the Beijing area, how should I render it?
This is how my data is parsed: `request.onload = function () { var arrayToMap = function (array) { return array.reduce(function (map, object) { map[object.name] = object; return map; }, {}); }