Spatial-Data-Science-and-GEO-AI-Lab / GreenExp_R

This is a R toolkit and developer version package to estimate multidimensional aspects of greenness and nature exposure, such as availability, accessibility and visibility using various geospatial data and models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

handling of year & planetary computer

mrd opened this issue · comments

if (year < '2020'||year > '2021'){

Note that year here is a string (character) not a number so the <, > operators are probably doing lexicographical comparison, not numerical. If someone provides a string like '2020a' it would pass your check even though that is a bad input. The initial thought is just to check directly if the year is '2020' or '2021' explicitly, no need to use inequalities.

More generally, this is something that will probably change in the future and for production purposes it's probably best not to hardcode these years into the code. Can valid years be detected from the planetary computer API?

Changed it by detecting the date in PC