1

I'm creating a script to do a time-series analysis over a large date range, preview/(Map.addLayer) the results on one specific day, and have that Map result be exportable.

The timeseries section is working well, and I have mosaics filtering for specific days to be mapped and then exported, but I would like to be able to add the date in some form on the description: of the Export.image.toDrive section. That appears to be extremely difficult as once you .mosaic an ee.ImageCollection, it removes all properties except for system:index, which is wiped of the original data and makes it useless.

I've seen this great example, however I don't need or want it to be iterated over multiple images in an ImageCollection over a large date range, just the filtered Mosaic on one particular day.

I've tried a few methods (.copyProperties, .get) found from other Stack Exchange/Overflow questions to no avail, but the closest I've gotten is through .set and .getInfo() in This Example Code:

// ### IMPORTED GEOMETRY ###
var Geom = 
    /* color: #0b4a8b */
    /* shown: false */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[-8.511494599189746, 52.915278842998354],
          [-8.511494599189746, 52.895607287195],
          [-8.478964768257129, 52.895607287195],
          [-8.478964768257129, 52.915278842998354]]], null, false);

// ### FILTER PARAMETERS ### 
//These apply the parameters to both L1C and L2A imagery and stop repetitive data entry
// CLOUD % format '00' , numbers only without quotes
var MIN_CLOUD_PERCENT = 20;
// START DATE & END DATE format: 'YYYY-MM-DD', include the quotes
var START_DATE = '2022-01-01';
var END_DATE = '2022-04-01';
// PREVIEW DATES are used to align all the visible map layers to the same date
var FRST_PRVW_DATE = '2022-03-30';
var LAST_PRVW_DATE = '2022-04-01';
// BOUNDS can either be a drawn geometry shape within GEE, or an imported SHP file
// See: https://developers.google.com/earth-engine/guides/table_upload#upload-a-shapefile
var BOUNDS = Geom;
// ZOOM is based on GEE's 1-24 level system. Larger number = Larger Zoom
var ZOOM = 14;
// PARAMETERS END - You don't need to change anything below this line to make the script function

// ### MISC ###
//Prints out the Parameters set
print('Filtering available Sentinel 2 imagery between ' + START_DATE + ' & ' + END_DATE + ' with ' + MIN_CLOUD_PERCENT + '% cloud over the area of interest.');
// Centre based on the Geometry (Region of Interest, Zoom Level)
Map.centerObject(BOUNDS, ZOOM, print('Map centered on Region of Interest'));
// Sets the default Map to Terrain mode (Roadmap overlain with hillsahde) 
Map.setOptions("TERRAIN");

// ### LAYER VISUALISATION ###

// Truecolour (R-G-B) Visualisation
var rgbVis = {
  min: 0,
  max: 0.35,
  bands: ['B4', 'B3', 'B2'],
};

// ### CLOUD MASKING ###
// Sentinel 2 Cloud Masking Function using the 60m Cloud Mask Band
/*  Function to mask clouds using the Sentinel-2 QA band
 *  @param {ee.Image} image Sentinel-2 image
 *  @return {ee.Image} cloud masked Sentinel-2 image
 */
function maskS2clouds(image) {
  var qa = image.select('QA60');
  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;
  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(qa.bitwiseAnd(cirrusBitMask).eq(0));
   return image.updateMask(mask).divide(10000).copyProperties(image, ["system:time_start"]);
}
print('Sentinel 2 Cloud Mask Function Complete');

// ### IMAGE COLLECTIONS ### 
//Load and Map L1C imagery with the filter parameters applied
                  /*
                  *  Load Sentinel-2 'Harmonized' Top Of Atomsphere (L1C) data
                  *  Dataset details: https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_HARMONIZED
                  *  HARMONIZED makes sure scenes after 25 January 2022 have the same DN ranges as older L1C scenes.
                  *  Harmonised L1C Data is available from Sentinel 2 Launch (2015-06-23) onwards.
                  */
var S2_L1C = ee.ImageCollection('COPERNICUS/S2_HARMONIZED')
                  // Filter by Date Period (YYYY-MM-DD)
                  .filterDate(START_DATE, END_DATE)
                  /* 
                  *  Pre-filter to get less cloudy granules
                  *  'Default' is aiming for 10% cloud
                  *  Dependent on availability of cloud-free imagery in the time period set
                  *  Longer periods will take longer to load
                  */
                  .filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', MIN_CLOUD_PERCENT))
                  // Select only image tiles that fall within the Geometry (Region of Interest) to reduce processing time
                  .filterBounds(BOUNDS)
                  // Applies the S2 Cloud Masking Function to each image in the IC
                  .map(maskS2clouds)
                  // Clips each image in the IC by the Bounds to reduce processing time further
                  .map(function(image) {
                    return image.clip(BOUNDS);
                  });

print('Time, Date, Bounding, and Cloud Tile Filtering parameters set for Imagery');

// ### MAPPING AND MOSAICING ###
// Add the pre-clipped IC to the map
Map.addLayer(S2_L1C.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE),rgbVis,'L1C_Filtered_IC');

var FilteredMosaic = S2_L1C.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE).mosaic().set("system:time_start", S2_L1C.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE).getInfo());
Map.addLayer(FilteredMosaic, rgbVis, 'L1C_Mosaic');


// ### EXPORTING ###
// Can't export the entire IC because it's an IC, it has to be an Image (hence the Mosaic)
Export.image.toDrive({
    image: FilteredMosaic.visualize(rgbVis), // Sets the image to keep the current Visualisation parameters
    region: Geom,
    description: 'L1C_Demo_' + FilteredMosaic.date().format('yy-MM-dd').getInfo(), // Sets the name of the image(s)
    folder: 'GEETestDemo', // The destination folder for the imagery in your Account's Google Drive
    scale: 'nominal', // Returns requested image AT TRUE SCALE
    crs: 'EPSG:3857', // CRS - This is the standard GEE Web Mercator projection, WGS84.
    maxPixels: 1e13, // Max Pixel amount - always required as the default limit is very small
    fileFormat: 'GeoTIFF'
});

I still get a horrendously long error, but it does give my Mosaic a system:time_start property, and within there is the original data inside, albeit all of it when I only want one Property:

Line 109: Image.date: Image has a 'system:time_start' property which is not a number: 
{features=[{bands=[{crs_transform=[60, 0, 499980, 0, -60, 5900040], crs=EPSG:32629, origin=[547, 617], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B1, dimensions=[38, 38]}, {crs_transform=[10, 0, 499980, 0, -10, 5900040], crs=EPSG:32629, origin=[3286, 3706], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B2, dimensions=[222, 222]}, {crs_transform=[10, 0, 499980, 0, -10, 5900040], crs=EPSG:32629, origin=[3286, 3706], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B3, dimensions=[222, 222]}, {crs_transform=[10, 0, 499980, 0, -10, 5900040], crs=EPSG:32629, origin=[3286, 3706], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B4, dimensions=[222, 222]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B5, dimensions=[111, 111]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B6, dimensions=[111, 111]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B7, dimensions=[111, 111]}, {crs_transform=[10, 0, 499980, 0, -10, 5900040], crs=EPSG:32629, origin=[3286, 3706], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B8, dimensions=[222, 222]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B8A, dimensions=[111, 111]}, {crs_transform=[60, 0, 499980, 0, -60, 5900040], crs=EPSG:32629, origin=[547, 617], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B9, dimensions=[38, 38]}, {crs_transform=[60, 0, 499980, 0, -60, 5900040], crs=EPSG:32629, origin=[547, 617], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B10, dimensions=[38, 38]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B11, dimensions=[111, 111]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=B12, dimensions=[111, 111]}, {crs_transform=[10, 0, 499980, 0, -10, 5900040], crs=EPSG:32629, origin=[3286, 3706], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=QA10, dimensions=[222, 222]}, {crs_transform=[20, 0, 499980, 0, -20, 5900040], crs=EPSG:32629, origin=[1643, 1853], data_type={min=0, max=429496.75, precision=float, type=PixelType}, id=QA20, dimensions=[111, 111]}, {crs_transform=[60, 0, 499980, 0, -60, 5900040], crs=EPSG:32629, origin=[547, 617], data_type={min=0, max=6.553500175476074, precision=float, type=PixelType}, id=QA60, dimensions=[38, 38]}], type=Image, properties={system:time_start=1648727202698, system:footprint={coordinates=[[[-8.511494599189746, 52.895607287195], [-8.495229683723437, 52.895607287195], [-8.478964768257129, 52.895607287195], [-8.478964768257127, 52.915278842998354], [-8.495229683723439, 52.915278842998354], [-8.511494599189747, 52.915278842998354], [-8.511494599189746, 52.895607287195]]], type=Polygon}, system:index=20220331T114349_20220331T114345_T29UNU}}], id=COPERNICUS/S2_HARMONIZED, bands=[], type=ImageCollection, version=1652454890835642, properties={date_range=[1435017600000, 1647993600000], period=0, system:visualization_0_min=0.0, type_name=ImageCollection, keywords=[copernicus, esa, eu, msi, radiance, sentinel], system:visualization_0_bands=B4,B3,B2, thumb=https://mw1.google.com/ges/dd/images/sentinel2_thumb.png, description=<p>Sentinel-2 is a wide-swath, high-resolution, multi-spectral
imaging mission supporting Copernicus Land Monitoring studies,
including the monitoring of vegetation, soil and water cover,
as well as observation of inland waterways and coastal areas.</p><p>The Sentinel-2 data contain 13 UINT16 spectral bands representing
TOA reflectance scaled by 10000. See the <a href="https://sentinel.esa.int/documents/247904/685211/Sentinel-2_User_Handbook">Sentinel-2 User Handbook</a>
for details. In addition, three QA bands are present where one
(QA60) is a bitmask band with cloud mask information. For more
details, <a href="https://sentinel.esa.int/web/sentinel/technical-guides/sentinel-2-msi/level-1c/cloud-masks">see the full explanation of how cloud masks are computed.</a></p><p>Each Sentinel-2 product (zip archive) may contain multiple
granules. Each granule becomes a separate Earth Engine asset.
EE asset ids for Sentinel-2 assets have the following format:
COPERNICUS/S2/20151128T002653_20151128T102149_T56MNN. Here the
first numeric part represents the sensing date and time, the
second numeric part represents the product generation date and
time, and the final 6-character string is a unique granule identifier
indicating its UTM grid reference (see <a href="https://en.wikipedia.org/wiki/Military_Grid_Reference_System">MGRS</a>).</p><p>The Level-2 data produced by ESA can be found in the collection
<a href="COPERNICUS_S2_SR">COPERNICUS/S2_SR</a>.</p><p>Clouds can be mostly removed by using
<a href="COPERNICUS_S2_CLOUD_PROBABILITY">COPERNICUS/S2_CLOUD_PROBABILITY</a>.
See
<a href="https://developers.google.com/earth-engine/tutorials/community/sentinel-2-s2cloudless">this tutorial</a>
explaining how to apply the cloud mask.</p><p>For more details on Sentinel-2 radiometric resolution, <a href="https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/resolutions/radiometric">see this page</a>.</p><p><b>Provider: <a href="https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types/level-1c">European Union/ESA/Copernicus</a></b><br><p><b>Revisit Interval</b><br>
  5 days
</p><p><b>Bands</b><table class="eecat"><tr><th scope="col">Name</th><th scope="col">Description</th></tr><tr><td>B1</td><td><p>Aerosols</p></td></tr><tr><td>B2</td><td><p>Blue</p></td></tr><tr><td>B3</td><td><p>Green</p></td></tr><tr><td>B4</td><td><p>Red</p></td></tr><tr><td>B5</td><td><p>Red Edge 1</p></td></tr><tr><td>B6</td><td><p>Red Edge 2</p></td></tr><tr><td>B7</td><td><p>Red Edge 3</p></td></tr><tr><td>B8</td><td><p>NIR</p></td></tr><tr><td>B8A</td><td><p>Red Edge 4</p></td></tr><tr><td>B9</td><td><p>Water vapor</p></td></tr><tr><td>B10</td><td><p>Cirrus</p></td></tr><tr><td>B11</td><td><p>SWIR 1</p></td></tr><tr><td>B12</td><td><p>SWIR 2</p></td></tr><tr><td>QA10</td><td><p>Always empty</p></td></tr><tr><td>QA20</td><td><p>Always empty</p></td></tr><tr><td>QA60</td><td><p>Cloud mask</p></td></tr><tr><td colspan=100>
      Bitmask for QA60
<ul><li>
          Bit 10: Opaque clouds
<ul><li>0: No opaque clouds</li><li>1: Opaque clouds present</li></ul></li><li>
          Bit 11: Cirrus clouds
<ul><li>0: No cirrus clouds</li><li>1: Cirrus clouds present</li></ul></li></ul></td></tr></table><p><b>Image Properties</b><table class="eecat"><tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Description</th></tr><tr><td>CLOUDY_PIXEL_PERCENTAGE</td><td>DOUBLE</td><td><p>Granule-specific cloudy pixel percentage taken from the original metadata</p></td></tr><tr><td>CLOUD_COVERAGE_ASSESSMENT</td><td>DOUBLE</td><td><p>Cloudy pixel percentage for the whole archive that
contains this granule. Taken from the original metadata</p></td></tr><tr><td>DATASTRIP_ID</td><td>STRING</td><td><p>Unique identifier of the datastrip Product Data Item (PDI)</p></td></tr><tr><td>DATATAKE_IDENTIFIER</td><td>STRING</td><td><p>Uniquely identifies a given Datatake. The ID contains
the Sentinel-2 satellite, start date and time, absolute orbit
number, and processing baseline.</p></td></tr><tr><td>DATATAKE_TYPE</td><td>STRING</td><td><p>MSI operation mode</p></td></tr><tr><td>DEGRADED_MSI_DATA_PERCENTAGE</td><td>DOUBLE</td><td><p>Percentage of degraded MSI and ancillary data</p></td></tr><tr><td>FORMAT_CORRECTNESS</td><td>STRING</td><td><p>Synthesis of the On-Line Quality Control (OLQC) checks
performed at granule (Product_Syntax) and datastrip (Product
Syntax and DS_Consistency) levels</p></td></tr><tr><td>GENERAL_QUALITY</td><td>STRING</td><td><p>Synthesis of the OLQC checks performed at the datastrip level (Relative_Orbit_Number)</p></td></tr><tr><td>GENERATION_TIME</td><td>DOUBLE</td><td><p>Product generation time</p></td></tr><tr><td>GEOMETRIC_QUALITY</td><td>STRING</td><td><p>Synthesis of the OLQC checks performed at the datastrip level (Attitude_Quality_Indicator)</p></td></tr><tr><td>GRANULE_ID</td><td>STRING</td><td><p>Unique identifier of the granule PDI (PDI_ID)</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B1</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B1 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B2</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B2 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B3</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B3 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B4</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B4 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B5</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B5 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B6</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B6 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B7</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B7 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B8</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B8 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B8A</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B8a and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B9</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B9 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B10</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B10 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B11</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B11 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_AZIMUTH_ANGLE_B12</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence azimuth angle average for band B12 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B1</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B1 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B2</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B2 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B3</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B3 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B4</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B4 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B5</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B5 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B6</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B6 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B7</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B7 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B8</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B8 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B8A</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B8a and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B9</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B9 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B10</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B10 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B11</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B11 and for all detectors</p></td></tr><tr><td>MEAN_INCIDENCE_ZENITH_ANGLE_B12</td><td>DOUBLE</td><td><p>Mean value containing viewing incidence zenith angle average for band B12 and for all detectors</p></td></tr><tr><td>MEAN_SOLAR_AZIMUTH_ANGLE</td><td>DOUBLE</td><td><p>Mean value containing sun azimuth angle average for all bands and detectors</p></td></tr><tr><td>MEAN_SOLAR_ZENITH_ANGLE</td><td>DOUBLE</td><td><p>Mean value containing sun zenith angle average for all bands and detectors</p></td></tr><tr><td>MGRS_TILE</td><td>STRING</td><td><p>US-Military Grid Reference System (MGRS) tile</p></td></tr><tr><td>PROCESSING_BASELINE</td><td>STRING</td><td><p>Configuration baseline used at the time of the product
generation in terms of processor software version and major Ground
Image Processing Parameters (GIPP) version</p></td></tr><tr><td>PRODUCT_ID</td><td>STRING</td><td><p>The full id of the original Sentinel-2 product</p></td></tr><tr><td>RADIOMETRIC_QUALITY</td><td>STRING</td><td><p>Based on the OLQC reports contained in the Datastrips/QI_DATA with RADIOMETRIC_QUALITY checklist name</p></td></tr><tr><td>REFLECTANCE_CONVERSION_CORRECTION</td><td>DOUBLE</td><td><p>Earth-Sun distance correction factor</p></td></tr><tr><td>SENSING_ORBIT_DIRECTION</td><td>STRING</td><td><p>Imaging orbit direction</p></td></tr><tr><td>SENSING_ORBIT_NUMBER</td><td>DOUBLE</td><td><p>Imaging orbit number</p></td></tr><tr><td>SENSOR_QUALITY</td><td>STRING</td><td><p>Synthesis of the OLQC checks performed at granule
(Missing_Lines, Corrupted_ISP, and Sensing_Time) and datastrip
(Degraded_SAD and Datation_Model) levels</p></td></tr><tr><td>SOLAR_IRRADIANCE_B1</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B1</p></td></tr><tr><td>SOLAR_IRRADIANCE_B2</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B2</p></td></tr><tr><td>SOLAR_IRRADIANCE_B3</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B3</p></td></tr><tr><td>SOLAR_IRRADIANCE_B4</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B4</p></td></tr><tr><td>SOLAR_IRRADIANCE_B5</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B5</p></td></tr><tr><td>SOLAR_IRRADIANCE_B6</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B6</p></td></tr><tr><td>SOLAR_IRRADIANCE_B7</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B7</p></td></tr><tr><td>SOLAR_IRRADIANCE_B8</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B8</p></td></tr><tr><td>SOLAR_IRRADIANCE_B8A</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B8a</p></td></tr><tr><td>SOLAR_IRRADIANCE_B9</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B9</p></td></tr><tr><td>SOLAR_IRRADIANCE_B10</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B10</p></td></tr><tr><td>SOLAR_IRRADIANCE_B11</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B11</p></td></tr><tr><td>SOLAR_IRRADIANCE_B12</td><td>DOUBLE</td><td><p>Mean solar exoatmospheric irradiance for band B12</p></td></tr><tr><td>SPACECRAFT_NAME</td><td>STRING</td><td><p>Sentinel-2 spacecraft name: Sentinel-2A, Sentinel-2B</p></td></tr></table><p><b>Terms of Use</b><br><p>The use of Sentinel data is governed by the <a href="https://scihub.copernicus.eu/twiki/pub/SciHubWebPortal/TermsConditions/Sentinel_Data_Terms_and_Conditions.pdf">Copernicus
Sentinel Data Terms and Conditions.</a></p><style>
  table.eecat {
  border: 1px solid black;
  border-collapse: collapse;
  font-size: 13px;
  }
  table.eecat td, tr, th {
  text-align: left; vertical-align: top;
  border: 1px solid gray; padding: 3px;
  }
  td.nobreak { white-space: nowrap; }
</style>, source_tags=[eu, esa, copernicus, sentinel], visualization_0_max=3000.0, provider_url=https://earth.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types/level-1c, title=Sentinel-2 MSI: MultiSpectral Instrument, Level-1C, sample=https://mw1.google.com/ges/dd/images/sentinel2_sample.png, tags=[copernicus, esa, eu, msi, radiance, sentinel], system:visualization_0_max=3000.0, product_tags=[msi, radiance], provider=European Union/ESA/Copernicus, visualization_0_min=0.0, system:visualization_0_name=RGB, visualization_0_name=RGB, visualization_0_bands=B4,B3,B2}}

So my question: Is there a way to slice this down to the intended system:time_start data, or even just the original system:index? I was looking into possibly using the callback property of getInfo(), but I'm still a novice so I'm not sure if this is the correct approach. I just want the date information from the filtered Image Collection on the Mosaic, and most importantly on the exported images so that they can be distinguished between multiple dates.

I could always fallback to just using the FRST_PRVW_DATE variable I already have as a simpler prefix/description, but that will always make the date incorrect (-1 day before the actual). Perhaps an alternative way would be to just have "FRST_PRVW_DATE + 1 Day" in the Export description.

2 Answers 2

1

I ended up figuring out my own question, so I'll just leave the solution here: Example Solution

// ### IMPORTED GEOMETRY ###
var Geom = 
    /* color: #0b4a8b */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[-11.11113449176787, 54.43227206644482],
          [-11.11113449176787, 51.305678054127945],
          [-8.093069992866504, 51.305678054127945],
          [-8.093069992866504, 54.43227206644482]]], null, false);
          
// Filtering imagery for hypothetical timeseries
var START_DATE = '2022-01-01';
var END_DATE = '2022-05-01';
// Filtering imagery to display a particular day on the Map.
var FRST_PRVW_DATE = '2022-03-30';
var LAST_PRVW_DATE = '2022-04-01';
// Setting the Area of Interest
var BOUNDS = Geom;

// Centers the Map on the Area of Interest
Map.centerObject(BOUNDS, 8);

// Sentinel 2 Image Collection and Cloud Masking
function maskS2clouds(image) {
  var qa = image.select('QA60');
  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;
  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(qa.bitwiseAnd(cirrusBitMask).eq(0));
   // Applies the cloud masking conditions to the IC, and adds the date of acquisition into each image for easy timeseries organising later
   return image.updateMask(mask).divide(10000).copyProperties(image, ["system:time_start"]);
}
var S2_L2A = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
            .filterDate(START_DATE, END_DATE)
            .filterBounds(BOUNDS)
            .map(maskS2clouds);
print('S2_L2A_Image Collection', S2_L2A); // Produces 1066 Images/Elements 

// Visualisation settings
var rgbVis = {
  min: 0,
  max: 0.35,
  bands: ['B4', 'B3', 'B2'],
};

// Add the Hypothetical timeseries range of imagery to Map (turned off by default because it's intensive)
Map.addLayer(S2_L2A, rgbVis, 'S2_L2A_IC', false);

// Filtering the timeseries range to just a particular day (i.e. 2022-03-31)
var S2_L2A_Filt = S2_L2A.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE);
print('S2_L2A_IC Filtered (2022-03-31)', S2_L2A_Filt); // Produces 13 Images/Elements that fit the date
// Selecting the first Element of the Filtered IC
var S2_L2A_Filt_1st = S2_L2A_Filt.first();
print ('S2_L2A_Filtered First Element', S2_L2A_Filt_1st); // Produces 1 Image (Element 0 of the previous var)

// Properties Extraction
// Pulls out the System:Index Property of every element in the Filtered IC, puts it in a dictionary, and inserts it into the Properties 
var SystemIndex = S2_L2A_Filt.map(function (image) {
  return image.set('SysIndex', image.toDictionary(['system:index']));
});
print('Property keys and values of S2_L2A_Filt', SystemIndex); // Returns the same 8 Images/Elements, but now with a 'SysIndex' Object in each Element
// This is done because just trying to extract the original system index brings up null values, or a "this is not a function" error.

// Aggregates the Dictionary into an Array
var list = SystemIndex.aggregate_array('SysIndex');
print('Agg. Array List', list); // Produces the List with only the values of the Dictionary from each Element
// Gets only the first Element of the List
var list_1st = list.get(0);
print('S2_L2A_IC, The First System:Index', list_1st); // Prints the first (0) Elements' System:Index Property. 

//Mosaic the S2_L2A_IC that was filtered to the day (Line 39), and gives it the property of the first Element of the List (Line 56)
var S2_L2A_Mosaic = S2_L2A.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE).mosaic().set(list_1st);
print('S2_Mosaic w/ Properties of the S2_L2A_Filtered_1st', S2_L2A_Mosaic); // The Mosaic now was the same System:Index of the First Element in the IC's List
// Add the Mosaic of one day's imagery to Map
Map.addLayer(S2_L2A_Mosaic, rgbVis, 'S2_L2A_Mosaic_2022_03_31');

// Gets the System:Index of the Mosaic as a String
var index = S2_L2A_Mosaic.get('system:index');
print('System Index in String',index); // "20220331T114349_20220331T114345_T28UGB"
/* Sentinel 2 Imagery follows this naming convention:
*  START TIME:'(YYYYMMDD)T(HHMMSS)_' + END TIME:'(YYYYMMDD)T(HHMMSS)_' + UTM MGRS ID: 'T00ABC'
*  So slicing it to the first 13 characters gives you the swath start time, to the minute
*  This is extracted using getInfo() which can then be put into the image name.
*/
var index = index.getInfo().slice(0,13);
print('Sliced System:Index', index); // "20220331T1143" (i.e. 11:43 AM on March 31st, 2022)

// Just to demonstrate the System:Index being added to the Exported name.
// 'Run' to see the other properties are correct before confirmation of download
// ### DON'T RUN THE TASK ON THE INITIATE EXPORT MENU ### It will be very large.
Export.image.toDrive({
    image: S2_L2A_Mosaic.visualize(rgbVis), // .visualize keeps the visualisation parameters for the image for export
    description: 'S2_L2A_'+ index, // The Tasks will show a "S2_L2A_20220331T1143" Download available
    folder: 'EE_OutputTest', // The destination folder for the imagery in your Account's Google Drive
    scale: 'nominal', // Returns requested image AT TRUE SCALE (i.e. 10m).
    crs: 'EPSG:3857', // The standard GEE and Wider Internet's Web Mercator Projection, WGS84.
    region: Geom, // The Area of Interest
    maxPixels: 1e13,
  });

In short;

  • Run a .map function to pull the system:index out of each image in the Image Collection, put them into a Dictionary, and add that to the Properties of each Image in the Image Collection. (This is important, as trying to extract the original system:index or system:start_time results in null). This has the added bonus of being able to extract different and/or multiple properties, should anyone wish.
  • Run .aggregate_array the created dictionary into a List. I can't explain why you need to do this, only that if you don't and try the next step on the Dictionary function itself, it will bring up an 'Invalid Type' error.
  • Create a variable to .get(0) the created List to show only the system:index property of the first Element/Image from the List.
  • In the .Mosaic, also .set the List_1st variable to the Mosaic. This puts the system:index property of the first Image/Element agg.array List into the Mosaic.
  • Then just create a variable to .get('system:index') on the Mosaic, and another to getInfo() and slice() to the string of interest (YYYYMMDDTHHMM). You could include another slice() section to this to include the Tile number (the last characters), or format it.
  • In the description section of the Export, insert the index variable and you'll have a simple method to insert the date from the first of an Image Collection to your Mosaic, and have it on the Export name.
0

First of all, you shouldn't use getInfo method in this way.

.
.
.
var FilteredMosaic = S2_L1C.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE).mosaic().set("system:time_start", S2_L1C.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE).getInfo());
.
.
.

    description: 'L1C_Demo_' + FilteredMosaic.date().format('yy-MM-dd').getInfo(), // Sets the name of the image(s)
.
.
.

The "system:time_start" property is a date object and your description task only a string object. So, by using an arbitrary date of ee.Date('2000') and 'L1C_Demo_' as name task prefix, your script runs properly by using getInfo as in following code snippet.

var date = ee.Date('2000');
var date_string = date.format().slice(0,10);

print(date_string);

var FilteredMosaic = S2_L1C.filterDate(FRST_PRVW_DATE, LAST_PRVW_DATE).mosaic()
.set("system:time_start", date);
Map.addLayer(FilteredMosaic, rgbVis, 'L1C_Mosaic');

print(FilteredMosaic);

// ### EXPORTING ###
// Can't export the entire IC because it's an IC, it has to be an Image (hence the Mosaic)
Export.image.toDrive({
    image: FilteredMosaic.visualize(rgbVis), // Sets the image to keep the current Visualisation parameters
    region: Geom,
    description: ee.String('L1C_Demo_').cat(date_string).getInfo(), // Sets the name of the image(s)
    folder: 'GEETestDemo', // The destination folder for the imagery in your Account's Google Drive
    scale: 'nominal', // Returns requested image AT TRUE SCALE
    crs: 'EPSG:3857', // CRS - This is the standard GEE Web Mercator projection, WGS84.
    maxPixels: 1e13, // Max Pixel amount - always required as the default limit is very small
    fileFormat: 'GeoTIFF'
});

After running complete code in this link, I got result of following image. Task ran successfully and its name has date appended as expected.

enter image description here

2
  • Ah, so I can't use `````getInfo()```` as I'd envisioned, thank you for the explanation. My criticism lies with that the date_string is manually defined and applies it to the Mosaic and the description. I would like to know if the original system: objects could be pulled automatically from the IC and applied to the Mosaic and description. I appreciate the method you outlined, but is there no method to get the system:time_start or system:index object/properties of the ImageCollections as a string for the Description of the Mosaic? Commented May 16, 2022 at 11:01
  • If I have to manually enter the date_string variable myself, what would be the advantage of this to reading off the system:time_start Object from the Image Collection via the Inspector and add the date to the title when I confirm the export in the Tasks tab? Commented May 16, 2022 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.