You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for maintaining the package. I found that rectify for curvilinear grids (i.e., MODIS swath data) returns a cropped rectilinear SpatRaster. Per the statement in the issue template, I did not include plots of rasters.
library(terra)
library(luna)
tdir<- tempdir()
# luna::getProducts("MOD06")date_start<-"2023-06-01"date_end<-"2023-06-02"aoi_in<- c(-79.5, -77, 34, 36)
mod06f<-luna::getNASA(
product="MOD06_L2",
start_date=date_start,
end_date=date_end,
aoi=aoi_in,
version="6.1",
server="LAADS",
download=TRUE,
username="****",
password="****",
path=tdir)
pathsds<- sprintf("HDF4_EOS:EOS_SWATH:%s:mod06:Cloud_Fraction", mod06f[1])
cloudfrac<- rast(pathsds)
# Warning message:# [rast] the data in this file are rotated. Use 'rectify' to fix thatcloudfrac# class : SpatRaster # dimensions : 406, 270, 1 (nrow, ncol, nlyr)# resolution : 0.01513012, 0.008826409 (x, y)# extent : -77.26448, -73.17935, 27.19393, 30.77745 (xmin, xmax, ymin, ymax)# coord. ref. : lon/lat WGS 84 (CRS84) (OGC:CRS84) # source : MOD06_L2.A2023152.0325.061.2023152155452.hdf:mod06:Cloud_Fraction # varname : MOD06_L2.A2023152.0325.061.2023152155452 # name : Cloud Fraction in Retrieval Re~m Pixels) from 1-km Cloud Mask cloudfrac_r<- rectify(cloudfrac)
cloudfrac_r# class : SpatRaster # dimensions : 470, 336, 1 (nrow, ncol, nlyr)# resolution : 0.01513012, 0.008826409 (x, y)# extent : -78.26307, -73.17935, 26.62904, 30.77745 (xmin, xmax, ymin, ymax)# coord. ref. : lon/lat WGS 84 (CRS84) (OGC:CRS84) # source(s) : memory# name : Cloud Fraction in Retrieval Re~m Pixels) from 1-km Cloud Mask # min value : 0 # max value : 1
It appears that rectify conserves the extent of the original curvilinear raster.
However, stars::st_warp seems to work as expected:
library(stars)
cloudfrac_st<- read_stars(pathsds)
# threshold set to 0.231967 : set a larger value if you see missing values where they shouldn't be# Warning message:# In transform_grid_grid(st_as_stars(src), st_dimensions(dest), threshold) :# using Euclidean distance measures on geodetic coordinatescloudfrac_st_r<- st_warp(cloudfrac_st, crs="OGC:CRS84")
# stars object with 2 dimensions and 1 attribute# attribute(s):# Min. 1st Qu. Median Mean 3rd Qu. Max. NA's# Cloud_Fraction 0 0.08 0.88 0.6097394 1 1 30183# dimension(s):# from to offset delta refsys x/y# x 1 385 -101.9 0.07729 WGS 84 [x]# y 1 286 45.98 -0.07729 WGS 84 [y]
I guess this issue related to the source in gdal_algs.cpp.
The text was updated successfully, but these errors were encountered:
Thank you for maintaining the package. I found that
rectify
for curvilinear grids (i.e., MODIS swath data) returns a cropped rectilinearSpatRaster
. Per the statement in the issue template, I did not include plots of rasters.It appears that
rectify
conserves the extent of the original curvilinear raster.However,
stars::st_warp
seems to work as expected:I guess this issue related to the source in gdal_algs.cpp.
The text was updated successfully, but these errors were encountered: