Skip to content

Commit

Permalink
v0.1.375
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 573107300
  • Loading branch information
Google Earth Engine Authors authored and naschmitz committed Oct 18, 2023
1 parent 8ed12bd commit 2170bb0
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 40 deletions.
2 changes: 1 addition & 1 deletion javascript/build/ee_api_js.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 21 additions & 15 deletions javascript/build/ee_api_js_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -17407,7 +17407,7 @@ goog.debug.entryPointRegistry.register(function(transformer) {
ee.apiclient = {};
var module$contents$ee$apiclient_apiclient = {};
ee.apiclient.VERSION = module$exports$ee$apiVersion.V1;
ee.apiclient.API_CLIENT_VERSION = "0.1.374";
ee.apiclient.API_CLIENT_VERSION = "0.1.375";
ee.apiclient.NULL_VALUE = module$exports$eeapiclient$domain_object.NULL_VALUE;
ee.apiclient.PromiseRequestService = module$exports$eeapiclient$promise_request_service.PromiseRequestService;
ee.apiclient.MakeRequestParams = module$contents$eeapiclient$request_params_MakeRequestParams;
Expand Down Expand Up @@ -17698,8 +17698,8 @@ module$contents$ee$apiclient_apiclient.send = function(path, params, callback, m
var profileHookAtCallTime = module$contents$ee$apiclient_apiclient.profileHook_, contentType = "application/x-www-form-urlencoded";
body && (contentType = "application/json", method && method.startsWith("multipart") && (contentType = method, method = "POST"));
method = method || "POST";
var headers = {"Content-Type":contentType}, version = "0.1.374";
"0.1.374" === version && (version = "latest");
var headers = {"Content-Type":contentType}, version = "0.1.375";
"0.1.375" === version && (version = "latest");
headers[module$contents$ee$apiclient_apiclient.API_CLIENT_VERSION_HEADER] = "ee-js/" + version;
var authToken = module$contents$ee$apiclient_apiclient.getAuthToken();
if (null != authToken) {
Expand Down Expand Up @@ -25090,23 +25090,26 @@ function module$contents$safevalues$builders$script_builders_safeScriptWithArgs(
module$exports$safevalues$builders$script_builders.safeScriptWithArgs = module$contents$safevalues$builders$script_builders_safeScriptWithArgs;
var module$exports$safevalues$builders$style_builders = {}, module$contents$safevalues$builders$style_builders_module = module$contents$safevalues$builders$style_builders_module || {id:"third_party/javascript/safevalues/builders/style_builders.closure.js"};
function module$contents$safevalues$builders$style_builders_safeStyle(templateObj) {
goog.DEBUG && module$contents$safevalues$internals$string_literal_assertIsTemplateObject(templateObj, 0);
var style = templateObj[0];
var rest = $jscomp.getRestArguments.apply(1, arguments);
goog.DEBUG && module$contents$safevalues$internals$string_literal_assertIsTemplateObject(templateObj, rest.length);
for (var stringifiedStyle = templateObj[0], i = 0; i < templateObj.length - 1; i++) {
stringifiedStyle += String(rest[i]) + templateObj[i + 1];
}
if (/[<>]/.test(stringifiedStyle)) {
throw Error("Forbidden characters in style string: " + stringifiedStyle);
}
if (goog.DEBUG) {
if (0 === style.length) {
return module$contents$safevalues$internals$style_impl_createStyleInternal(style);
}
if (/[<>]/.test(style)) {
throw Error("Forbidden characters in style string: " + style);
if (0 === stringifiedStyle.length) {
return module$contents$safevalues$internals$style_impl_createStyleInternal(stringifiedStyle);
}
if (!/;$/.test(style)) {
throw Error('Style string does not end with ";": ' + style);
if (!/;$/.test(stringifiedStyle)) {
throw Error('Style string does not end with ";": ' + stringifiedStyle);
}
if (!/:/.test(style)) {
throw Error('Style string should contain one or more ":": ' + style);
if (!/:/.test(stringifiedStyle)) {
throw Error('Style string should contain one or more ":": ' + stringifiedStyle);
}
}
return module$contents$safevalues$internals$style_impl_createStyleInternal(style);
return module$contents$safevalues$internals$style_impl_createStyleInternal(stringifiedStyle);
}
module$exports$safevalues$builders$style_builders.safeStyle = module$contents$safevalues$builders$style_builders_safeStyle;
function module$contents$safevalues$builders$style_builders_concatStyles(styles) {
Expand Down Expand Up @@ -25209,6 +25212,9 @@ var module$contents$safevalues$builders$url_builders_DEFAULT_SCHEMES = [module$e
module$exports$safevalues$builders$url_builders.SanitizableUrlScheme.FTP, module$exports$safevalues$builders$url_builders.SanitizableUrlScheme.RELATIVE];
function module$contents$safevalues$builders$url_builders_trySanitizeUrl(url, allowedSchemes) {
allowedSchemes = void 0 === allowedSchemes ? module$contents$safevalues$builders$url_builders_DEFAULT_SCHEMES : allowedSchemes;
if (module$contents$safevalues$internals$url_impl_isUrl(url)) {
return url;
}
for (var i = 0; i < allowedSchemes.length; ++i) {
var scheme = allowedSchemes[i];
if (module$contents$safevalues$builders$url_builders_isValidScheme(scheme) && scheme.isValid(url)) {
Expand Down
36 changes: 21 additions & 15 deletions javascript/build/ee_api_js_npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17407,7 +17407,7 @@ goog.debug.entryPointRegistry.register(function(transformer) {
ee.apiclient = {};
var module$contents$ee$apiclient_apiclient = {};
ee.apiclient.VERSION = module$exports$ee$apiVersion.V1;
ee.apiclient.API_CLIENT_VERSION = "0.1.374";
ee.apiclient.API_CLIENT_VERSION = "0.1.375";
ee.apiclient.NULL_VALUE = module$exports$eeapiclient$domain_object.NULL_VALUE;
ee.apiclient.PromiseRequestService = module$exports$eeapiclient$promise_request_service.PromiseRequestService;
ee.apiclient.MakeRequestParams = module$contents$eeapiclient$request_params_MakeRequestParams;
Expand Down Expand Up @@ -17698,8 +17698,8 @@ module$contents$ee$apiclient_apiclient.send = function(path, params, callback, m
var profileHookAtCallTime = module$contents$ee$apiclient_apiclient.profileHook_, contentType = "application/x-www-form-urlencoded";
body && (contentType = "application/json", method && method.startsWith("multipart") && (contentType = method, method = "POST"));
method = method || "POST";
var headers = {"Content-Type":contentType}, version = "0.1.374";
"0.1.374" === version && (version = "latest");
var headers = {"Content-Type":contentType}, version = "0.1.375";
"0.1.375" === version && (version = "latest");
headers[module$contents$ee$apiclient_apiclient.API_CLIENT_VERSION_HEADER] = "ee-js/" + version;
var authToken = module$contents$ee$apiclient_apiclient.getAuthToken();
if (null != authToken) {
Expand Down Expand Up @@ -25090,23 +25090,26 @@ function module$contents$safevalues$builders$script_builders_safeScriptWithArgs(
module$exports$safevalues$builders$script_builders.safeScriptWithArgs = module$contents$safevalues$builders$script_builders_safeScriptWithArgs;
var module$exports$safevalues$builders$style_builders = {}, module$contents$safevalues$builders$style_builders_module = module$contents$safevalues$builders$style_builders_module || {id:"third_party/javascript/safevalues/builders/style_builders.closure.js"};
function module$contents$safevalues$builders$style_builders_safeStyle(templateObj) {
goog.DEBUG && module$contents$safevalues$internals$string_literal_assertIsTemplateObject(templateObj, 0);
var style = templateObj[0];
var rest = $jscomp.getRestArguments.apply(1, arguments);
goog.DEBUG && module$contents$safevalues$internals$string_literal_assertIsTemplateObject(templateObj, rest.length);
for (var stringifiedStyle = templateObj[0], i = 0; i < templateObj.length - 1; i++) {
stringifiedStyle += String(rest[i]) + templateObj[i + 1];
}
if (/[<>]/.test(stringifiedStyle)) {
throw Error("Forbidden characters in style string: " + stringifiedStyle);
}
if (goog.DEBUG) {
if (0 === style.length) {
return module$contents$safevalues$internals$style_impl_createStyleInternal(style);
}
if (/[<>]/.test(style)) {
throw Error("Forbidden characters in style string: " + style);
if (0 === stringifiedStyle.length) {
return module$contents$safevalues$internals$style_impl_createStyleInternal(stringifiedStyle);
}
if (!/;$/.test(style)) {
throw Error('Style string does not end with ";": ' + style);
if (!/;$/.test(stringifiedStyle)) {
throw Error('Style string does not end with ";": ' + stringifiedStyle);
}
if (!/:/.test(style)) {
throw Error('Style string should contain one or more ":": ' + style);
if (!/:/.test(stringifiedStyle)) {
throw Error('Style string should contain one or more ":": ' + stringifiedStyle);
}
}
return module$contents$safevalues$internals$style_impl_createStyleInternal(style);
return module$contents$safevalues$internals$style_impl_createStyleInternal(stringifiedStyle);
}
module$exports$safevalues$builders$style_builders.safeStyle = module$contents$safevalues$builders$style_builders_safeStyle;
function module$contents$safevalues$builders$style_builders_concatStyles(styles) {
Expand Down Expand Up @@ -25209,6 +25212,9 @@ var module$contents$safevalues$builders$url_builders_DEFAULT_SCHEMES = [module$e
module$exports$safevalues$builders$url_builders.SanitizableUrlScheme.FTP, module$exports$safevalues$builders$url_builders.SanitizableUrlScheme.RELATIVE];
function module$contents$safevalues$builders$url_builders_trySanitizeUrl(url, allowedSchemes) {
allowedSchemes = void 0 === allowedSchemes ? module$contents$safevalues$builders$url_builders_DEFAULT_SCHEMES : allowedSchemes;
if (module$contents$safevalues$internals$url_impl_isUrl(url)) {
return url;
}
for (var i = 0; i < allowedSchemes.length; ++i) {
var scheme = allowedSchemes[i];
if (module$contents$safevalues$builders$url_builders_isValidScheme(scheme) && scheme.isValid(url)) {
Expand Down
2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@google/earthengine",
"version": "0.1.374",
"version": "0.1.375",
"description": "JavaScript client for Google Earth Engine API.",
"author": "Google LLC",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion javascript/src/apiclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {PromiseRequestService} = goog.require('eeapiclient.promise_request_servic
/** @namespace */
const apiclient = {};

const API_CLIENT_VERSION = '0.1.374';
const API_CLIENT_VERSION = '0.1.375';

exports.VERSION = apiVersion.VERSION;
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
Expand Down
57 changes: 57 additions & 0 deletions javascript/src/examples/CloudMasking/Sentinel2ClearComposite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// This example demonstrates how to use Cloud Score+ QA bands to
// create a clear Sentinel-2 median composite.
//


// Region of interest.
var roi = ee.Geometry.Rectangle([-124.8697, 35.5806, -119.9917, 39.9554]);

// Harmonized Sentinel-2 Level 2A collection.
var s2 = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED');

// Cloud Score+ image collection. Note Cloud Score+ is produced
// from Sentinel-2 Level 1C data and can be applied to either L1C
// or L2A collections.
var csPlus = ee.ImageCollection('GOOGLE/CLOUD_SCORE_PLUS/V1/S2_HARMONIZED');

// Get list of Sentinel-2 bands.
var csPlusBands = csPlus.first().bandNames();

// Link S2 and CS+ results.
var linkedCollection = s2.linkCollection(csPlus, csPlusBands);
// Date range for median composite.
var dateStart = '2023-03-01';
var dateEnd = '2023-09-01';

/**
* Masks pixels with low CS+ QA scores.
* @param {ee.Image} image Sentinel-2 image
* @return {ee.Image} masked Sentinel-2 image
*/
function maskLowQA(image) {
// CS+ QA band to use for masking. Options are 'cs' and 'cs_cdf'.
var qaBand = 'cs';

// Adjustable threshold for converting CS+ QA to a binary mask.
// Higher thresholds will mask out partial occlusions like thin clouds, haze &
// cirrus shadows. Lower thresholds will be more permissive of these
// occlusions.
var clearThreshold = 0.60;
var mask = image.select(qaBand).gte(clearThreshold);

return image.updateMask(mask);
}


// Filter collection, mask pixels with low QA scores, and
// generate median composite.
var composite = linkedCollection.filterBounds(roi)
.filterDate(dateStart, dateEnd)
.map(maskLowQA)
.median();

// Sentinel-2 visualization parameters.
var s2Viz = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000};

Map.addLayer(composite, s2Viz, 'median composite');
Map.centerObject(roi, 11);
2 changes: 1 addition & 1 deletion python/ee/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""The EE Python library."""

__version__ = '0.1.374'
__version__ = '0.1.375'

# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
Expand Down
31 changes: 25 additions & 6 deletions python/ee/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,10 +760,15 @@ def listFeatures(params: Dict[str, Any]) -> Any:
GeoJSON geometry string (see RFC 7946).
filter - If present, specifies additional simple property filters
(see https://google.aip.dev/160).
fileFormat - The resulting output format.
fileFormat - If present, specifies an output format for the tabular data.
The function makes a network request for each page until the entire
table has been fetched. The number of fetches depends on the number of
rows in the table and pageSize. pageToken is ignored. Supported
formats are: PANDAS_DATAFRAME for a Pandas DataFrame and
GEOPANDAS_GEODATAFRAME for a GeoPandas GeoDataFrame.
Returns:
A dictionary containing:
A Pandas DataFrame, GeoPandas GeoDataFrame, or a dictionary containing:
- "type": always "FeatureCollection" marking this object as a GeoJSON
feature collection.
- "features": a list of GeoJSON features.
Expand Down Expand Up @@ -795,7 +800,9 @@ def getPixels(params: Dict[str, Any]) -> Any:
assetId - The asset ID for which to get pixels. Must be an image asset.
fileFormat - The resulting file format. Defaults to png. See
https://developers.google.com/earth-engine/reference/rest/v1/ImageFileFormat
for the available formats.
for the available formats. There are additional formats that convert
the downloaded object to a Python data object. These include:
NUMPY_NDARRAY, which converts to a structured NumPy array.
grid - Parameters describing the pixel grid in which to fetch data.
Defaults to the native pixel grid of the data.
region - If present, the region of data to return, specified as a GeoJSON
Expand Down Expand Up @@ -835,7 +842,9 @@ def computePixels(params: Dict[str, Any]) -> Any:
expression - The expression to compute.
fileFormat - The resulting file format. Defaults to png. See
https://developers.google.com/earth-engine/reference/rest/v1/ImageFileFormat
for the available formats.
for the available formats. There are additional formats that convert
the downloaded object to a Python data object. These include:
NUMPY_NDARRAY, which converts to a structured NumPy array.
grid - Parameters describing the pixel grid in which to fetch data.
Defaults to the native pixel grid of the data.
bandIds - If present, specifies a specific set of bands from which to get
Expand Down Expand Up @@ -902,11 +911,21 @@ def computeFeatures(params: Dict[str, Any]) -> Any:
1000 results per page.
pageToken - A token identifying a page of results the server should
return.
fileFormat - The resulting output format.
fileFormat - If present, specifies an output format for the tabular data.
The function makes a network request for each page until the entire
table has been fetched. The number of fetches depends on the number of
rows in the table and pageSize. pageToken is ignored. Supported
formats are: PANDAS_DATAFRAME for a Pandas DataFrame and
GEOPANDAS_GEODATAFRAME for a GeoPandas GeoDataFrame.
workloadTag - User supplied tag to track this computation.
Returns:
A list with the results of the computation.
A Pandas DataFrame, GeoPandas GeoDataFrame, or a dictionary containing:
- "type": always "FeatureCollection" marking this object as a GeoJSON
feature collection.
- "features": a list of GeoJSON features.
- "next_page_token": A token to retrieve the next page of results in a
subsequent call to this function.
"""
params = params.copy()
params['expression'] = serializer.encode(params['expression'])
Expand Down

0 comments on commit 2170bb0

Please sign in to comment.