MCPcopy
hub / github.com/google/earthengine-api / _prepare_table_export_config

Function _prepare_table_export_config

python/ee/batch.py:1310–1380  ·  view source on GitHub ↗

Performs all preparation steps for a table export. Args: collection: The FeatureCollection to be exported. config: All the user-specified export parameters. May be modified. export_destination: One of the Task.ExportDestination values. Returns: A config dict containing all info

(
    collection: _arg_types.FeatureCollection,
    config: dict[str, Any],
    export_destination: Task.ExportDestination,
)

Source from the content-addressed store, hash-verified

1308
1309
1310def _prepare_table_export_config(
1311 collection: _arg_types.FeatureCollection,
1312 config: dict[str, Any],
1313 export_destination: Task.ExportDestination,
1314) -> dict[str, Any]:
1315 """Performs all preparation steps for a table export.
1316
1317 Args:
1318 collection: The FeatureCollection to be exported.
1319 config: All the user-specified export parameters. May be modified.
1320 export_destination: One of the Task.ExportDestination values.
1321
1322 Returns:
1323 A config dict containing all information required for the export.
1324 """
1325 if (
1326 export_destination not in NON_FILE_DESTINATIONS
1327 and 'fileFormat' not in config
1328 ):
1329 config['fileFormat'] = 'CSV'
1330
1331 _canonicalize_parameters(config, export_destination)
1332
1333 # Build an ExportMapRequest. Delete values from "config" as we go so we
1334 # can check at the end for any leftovers. Any computed objects will be
1335 # serialised in data.py before the request is sent.
1336 request = {}
1337 request['expression'] = collection
1338 if 'description' in config:
1339 request['description'] = config.pop('description')
1340
1341 if export_destination == Task.ExportDestination.ASSET:
1342 request['assetExportOptions'] = {
1343 'earthEngineDestination': _build_earth_engine_destination(config)
1344 }
1345 elif export_destination == Task.ExportDestination.FEATURE_VIEW:
1346 request['featureViewExportOptions'] = {
1347 'featureViewDestination':
1348 _build_feature_view_destination(config),
1349 'ingestionTimeParameters':
1350 build_ingestion_time_parameters(
1351 config.pop('ingestionTimeParameters', None))
1352 }
1353 elif export_destination == Task.ExportDestination.BIGQUERY:
1354 request['bigqueryExportOptions'] = {
1355 'bigqueryDestination': _build_bigquery_destination(config)
1356 }
1357 else:
1358 request['fileExportOptions'] = _build_table_file_export_options(
1359 config, export_destination)
1360
1361 if 'selectors' in config:
1362 # Strings have been turned into lists but we still might be holding a
1363 # tuple or other non-list iterable.
1364 request['selectors'] = list(config.pop('selectors'))
1365
1366 if 'maxVertices' in config:
1367 request['maxVertices'] = {'value': int(config.pop('maxVertices'))}

Callers 5

toCloudStorageMethod · 0.85
toDriveMethod · 0.85
toAssetMethod · 0.85
toFeatureViewMethod · 0.85
toBigQueryMethod · 0.85

Tested by

no test coverage detected