admin管理员组文章数量:1185646
I've quite new to working with satellite data and the Google Earth Engine (GEE). I've been working on using their machine leanring models to train a classifier. I then attempted to understands some of the regional statistics using the ReduceRegions() function to calculate the mean water temperature and salinity.
Each of the regions are created using polygons.
Here's a code snippet of the functionality:
var mariculture_regions = classified_threshold.selfMask();
var region_features = [
ee.Feature(AOI_Saul, {region: 'Sual'}),
ee.Feature(AOI_Burgos, {region: 'Burgos'}),
ee.Feature(AOI_Ormoc, {region: 'Ormoc'}),
ee.Feature(AOI_Balingasag, {region: 'Balingasag'}),
ee.Feature(AOI_Panabo, {region: 'Panabo'})
];
var all_regions = ee.FeatureCollection(region_features);
var mariculture_geometries = all_regions.filterBounds(mariculture_regions.geometry());
/*
Extract water temperature and salinity at 2m depth for mariculture sites.
*/
var sea_temp_salinity = hycom_sea_temp_salinity
.filter(ee.Filter.date('2024-01-01', '2024-01-15'))
.filter(ee.Filter.bounds(all_regions));
var seaWaterTemperature = sea_temp_salinity.select('water_temp_2')
.map(function scaleAndOffset(image) {
return ee.Image(image).multiply(0.001).add(20);
}).first();
var seaSalinity = sea_temp_salinity.select('salinity_2')
.map(function scaleAndOffset(image) {
return ee.Image(image).multiply(0.001).add(20);
}).first();
var mariculture_water_stats = mariculture_regions.addBands(seaWaterTemperature, ['water_temp_2']).addBands(seaSalinity, ['salinity_2']);
var stats = mariculture_water_stats.sampleRegions({
collection: mariculture_geometries,
scale: 10,
geometries: true
});
var mariculture_means = mariculture_water_stats.select(['water_temp_2', 'salinity_2']).reduceRegions({
collection: mariculture_geometries.limit(1000),
reducer: ee.Reducer.mean(),
scale: 10,
tileScale: 16
});
print(mariculture_means);
print(stats)
Ideally I should be able to obtain the means for water temperature and salinity for all regions. However, both the reduceRegions() and sampleRegions() only return the mean values for the "Sual" region.
I've attempted the following with no success:
- Adding CRS transforms, tileScale, bestEffort.
- Changing the order of regions.
- Using reduceRegion() for each region individually.
In all the above cases only the mean value for "Sual" is valid and the rest are null. I am quite perplexed as to where I have gone wrong with my code.
版权声明:本文标题:javascript - GEE: reduceRegions() and sampleRegions() returns null values for certain geometries - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738261423a2071837.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论