A full description of the sinusoidal projection is provided on the lpdaac page: https://lpdaac.usgs.gov/dataset_discovery/modis and wikipedia: https://en.wikipedia.org/wiki/Sinusoidal_projection
sin_to_ll(x, y)
sinusoidal x coordinate (vector)
sinusoidal y coordinate (vector)
# \donttest{
# Download some test data
subset <- mt_subset(product = "MOD11A2",
lat = 40,
lon = -110,
band = "LST_Day_1km",
start = "2004-01-01",
end = "2004-03-31",
progress = FALSE)
# convert sinusoidal to lat / lon
lat_lon <- sin_to_ll(subset$xllcorner, subset$yllcorner)
# bind with the original dataframe
subset <- cbind(subset, lat_lon)
head(subset)
#> xllcorner yllcorner cellsize nrows ncols band units
#> 1.1 -9370036.35 4446875.49 926.625433055834 1 1 LST_Day_1km Kelvin
#> 2.1 -9370036.35 4446875.49 926.625433055834 1 1 LST_Day_1km Kelvin
#> 3.1 -9370036.35 4446875.49 926.625433055834 1 1 LST_Day_1km Kelvin
#> 4.1 -9370036.35 4446875.49 926.625433055834 1 1 LST_Day_1km Kelvin
#> 5.1 -9370036.35 4446875.49 926.625433055834 1 1 LST_Day_1km Kelvin
#> 6.1 -9370036.35 4446875.49 926.625433055834 1 1 LST_Day_1km Kelvin
#> scale latitude longitude site product start end complete
#> 1.1 0.02 40 -110 sitename MOD11A2 2004-01-01 2004-03-31 TRUE
#> 2.1 0.02 40 -110 sitename MOD11A2 2004-01-01 2004-03-31 TRUE
#> 3.1 0.02 40 -110 sitename MOD11A2 2004-01-01 2004-03-31 TRUE
#> 4.1 0.02 40 -110 sitename MOD11A2 2004-01-01 2004-03-31 TRUE
#> 5.1 0.02 40 -110 sitename MOD11A2 2004-01-01 2004-03-31 TRUE
#> 6.1 0.02 40 -110 sitename MOD11A2 2004-01-01 2004-03-31 TRUE
#> modis_date calendar_date tile proc_date pixel value longitude_ll
#> 1.1 A2004001 2004-01-01 h09v05 2020168005635 1 13129 -109.9889
#> 2.1 A2004009 2004-01-09 h09v05 2020168010833 1 13102 -109.9889
#> 3.1 A2004017 2004-01-17 h09v05 2020168012220 1 13343 -109.9889
#> 4.1 A2004025 2004-01-25 h09v05 2020168013617 1 13364 -109.9889
#> 5.1 A2004033 2004-02-02 h09v05 2020168015053 1 13364 -109.9889
#> 6.1 A2004041 2004-02-10 h09v05 2020168022045 1 13272 -109.9889
#> latitude_ll
#> 1.1 39.99167
#> 2.1 39.99167
#> 3.1 39.99167
#> 4.1 39.99167
#> 5.1 39.99167
#> 6.1 39.99167
# }