Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: object 'AllAngle_Composite_Snow_Free' not found #7

Closed
nikosGeography opened this issue Feb 20, 2024 · 2 comments
Closed

Error: object 'AllAngle_Composite_Snow_Free' not found #7

nikosGeography opened this issue Feb 20, 2024 · 2 comments

Comments

@nikosGeography
Copy link

nikosGeography commented Feb 20, 2024

Hi, I just started using the package and I'm impressed about it's simplicity. Great work!. I am trying to download a monthly image (VNP46A3) for April 2018, and the variable I am interested in is the AllAngle_Composite_Snow_Free. Here is the code:

library(blackmarbler)
library(sf)
library(raster)
library(terra)

#### Define NASA bearer token
bearer <- "my_bearer"

### ROI
roi_sf <- st_read("path/ny_4326.shp")

### Monthly data: raster for April 2018
r_201804 <- bm_raster(roi_sf = roi_sf,
                      product_id = "VNP46A3",
                      date = "2018-04", # The day is ignored
                      variable = "AllAngle_Composite_Snow_Free",
                      quality_flag_rm = c(1, 2),
                      bearer = bearer)

Two questions and a recommendation:

  1. Is it possible to keep the water bodies in the NTL images? If yes, how? I could fill the water bodies with 0, but that's not very safe because the images might contain non-water bodies that ha been eliminated due to poor quality pixels.
  2. in the parameter quality_flag_rm, I want to keep only the good quality pixels (bit 0). Is this the correct way to add the vectors?

Recommendation

  1. The raster package has been replaced from the terra package. Are you planning to migrate to terra?

Thank you.

@ramarty
Copy link
Contributor

ramarty commented Feb 20, 2024

Hi @nikosGeography - Great to hear the package is useful!

1/ Good question on water bodies. I think the tricky thing here is that BlackMarble flags water bodies with a fill value. So doing the below (ie, removing quality_flag_rm) will only keep pixels without a fill value. Most of these should be water bodies, but others could be cases where the fill value is applied for other reasons -- but I think for the most part these will likely correspond to water).

r_201804 <- bm_raster(roi_sf = roi_sf,
product_id = "VNP46A3",
date = "2018-04", # The day is ignored
variable = "AllAngle_Composite_Snow_Free",
bearer = bearer)

2/ Yep, using quality_flag_rm = c(1, 2) will only keep good quality pixels. That'll remove poor-quality pixels -- for monthly/annual, (pixels based on 3 or less observations) or gap filled observations),

And yep, good recommendation - that's on the to-do list to migrate to terra so aiming to get that done relatively soon!

@nikosGeography
Copy link
Author

Thank you for your fast reply. I apologize for the misleading title, I was searching for an error online and accidentaly I pasted the error message here.

Keep up the good work guys, looking forward to the migration to terra and other updates. Lastly, BlackMarble's User guide (v 1.2), Table 9, it has a Land/Water mask. Maybe you could include that as well in the function bm_raster()? I believe it is this mask that controls if water bodies should be included or excluded from the image.

But again, that's something minor I guess. Anyway, good job again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants