Skip to content

sampleSites function returning Parsing date error #16

@ronnyhdez

Description

@ronnyhdez

When setting the dates in my asset as follows:

var renameProperty = function(feature) {
  var year = ee.Number(feature.get('rclmtn_d')).format('%d');
  feature = feature.set('system:time_start', year.cat('-01-01'))
                  .set('system:time_end', '2023-01-01');

  return feature;
};

// Apply the function 
var intersects = intersects.map(renameProperty);

I got an error when using the function as follows:

sitesDictionaryL08SR = LEAF.sampleSites(
    site,
    imageCollectionName="LANDSAT/LC08/C02/T1_L2",
    algorithm=SL2PV0,
    variableName="Surface_Reflectance",
    maxCloudcover=90,
    outputScaleSize=30,
    inputScaleSize=30,
    bufferSpatialSize=0,
    bufferTemporalSize=[0, 0]
    # subsamplingFraction=0.99,
    # numPixels=100
)

The error:

EEException: Date.parse: Date/time '2021-01-01' cannot be parsed with format 'DD/MM/yy'."

The parsing line in the leaf.py is the following:

startDate = datetime.fromtimestamp(ee.Date.parse("dd/MM/YY",site.get('system:time_start'),'Etc/GMT+6').getInfo()['value']/1000) + timedelta(days=bufferTemporalSize[0])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions