rfernand387 / LEAF-Toolbox

MIT License
41 stars 20 forks source link

sampleSites function returning Parsing date error #16

Open ronnyhdez opened 1 month ago

ronnyhdez commented 1 month ago

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:

https://github.com/rfernand387/LEAF-Toolbox/blob/607a3c3b0b2864840bca162b9ea3a50f5bc91c86/Source-Python/production/LEAF.py#L298

JakeEckersley commented 2 weeks ago

Seconded. ran into a similar issue when trying to use imageSites function with the default assets. Have attempted to debug to no avail.