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

Setting quiet=TRUE in bm_raster doesn't make it run quietly #6

Open
simon-smart88 opened this issue Feb 13, 2024 · 3 comments
Open

Comments

@simon-smart88
Copy link
Contributor

The documentation for bm_raster() says that setting quiet=TRUE will "Suppress output that show downloading progress and other messages." but if even when I set this, I get a download progress bar. This is especially inconvenient if you knit an Rmd containing a call to the function as it prints > 100 lines and there doesn't seem to be a way to suppress it.

I think the problem lies here:

response <- httr::GET(url,
and could be fixed by only including the progress() in that function if quiet = FALSE

@ramarty
Copy link
Contributor

ramarty commented Feb 19, 2024

@simon-smart88 Thanks for flagging this! Just made a fix in the development version, so if you install via:

devtools::install_github("worldbank/blackmarbler")

quiet=TRUE should work as expected. However, let me know if you still run into any issues. I'll get this to CRAN soon.

@simon-smart88
Copy link
Contributor Author

Yes all good now - thanks!

@simon-smart88
Copy link
Contributor Author

@ramarty Not too much of a problem, but recently there's some new printed output coming through even when quiet = TRUE. I've set quiet = FALSE here to show it's happening after the files are downloaded. I had a look around but couldn't see what might be causing it.

library(sf)

square_coords <- matrix(c(
  -1.1, 50.5,  
  0.9,  50.5, 
  0.9,  52.5,  
  -1.1, 52.5,  
  -1.1, 50.5   
), ncol = 2, byrow = TRUE)

square_polygon <- st_polygon(list(square_coords))
square_sf <- st_sfc(square_polygon, crs = 4326)  
sf_object <- st_sf(geometry = square_sf)

blackmarbler::bm_raster(roi_sf = sf_object,
                        product_id = "VNP46A4",
                        date = "2021",
                        bearer = Sys.getenv("NASA_bearer"),
                        quiet = FALSE)
Processing 2 nighttime light tiles
Processing: VNP46A4.A2021001.h17v03.001.2022094115448.h5
  |=================================================================================================================================| 100%
Processing: VNP46A4.A2021001.h18v03.001.2022094115528.h5
  |=================================================================================================================================| 100%
ext 0: -10 -6 56.6667 60 
ext 0: -6 -2 56.6667 60 
ext 0: -2 2 56.6667 60 
ext 1: -2 2 56.6667 60 
ext 0: 2 6 56.6667 60 
ext 0: 6 10 56.6667 60 
ext 0: -10 -6 53.3333 56.6667 
ext 0: -6 -2 53.3333 56.6667 
ext 0: -2 2 53.3333 56.6667 
ext 1: -2 2 53.3333 56.6667 
ext 0: 2 6 53.3333 56.6667 
ext 0: 6 10 53.3333 56.6667 
ext 0: -10 -6 50 53.3333 
ext 0: -6 -2 50 53.3333 
ext 0: -2 2 50 53.3333 
ext 1: -2 2 50 53.3333 
ext 0: 2 6 50 53.3333 
ext 0: 6 10 50 53.3333 
class       : SpatRaster 
dimensions  : 480, 480, 1  (nrow, ncol, nlyr)
resolution  : 0.004166667, 0.004166667  (x, y)
extent      : -1.1, 0.9, 50.5, 52.5  (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326) 
source(s)   : memory
name        : t2021 
min value   :   0.0 
max value   : 448.9 

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