Git Product home page Git Product logo

blackmarbler's Introduction

BlackMarbleR

CRAN_Status_Badge downloads GitHub Repo stars activity License: MIT

BlackMarbleR is a R package that provides a simple way to use nighttime lights data from NASA's Black Marble. Black Marble is a NASA Earth Science Data Systems (ESDS) project that provides a product suite of daily, monthly and yearly global nighttime lights. This package automates the process of downloading all relevant tiles from the NASA LAADS DAAC to cover a region of interest, converting and mosaicing the raw files (in HDF5 format) to georeferenced rasters.

Installation

The package can be installed via CRAN.

install.packages("blackmarbler")

To install the development version from Github:

# install.packages("devtools")
devtools::install_github("worldbank/blackmarbler")

Bearer Token

The function requires using a Earthdata Download Bearer Token; to obtain a token, follow the below steps:

  1. Go to the NASA LAADS Archive
  2. Click "Login" (button on top right), and click "Earthdata Login"; create an account if needed.
  3. Once logged on, from the NASA LAADS Archive page, click "Login" again
  4. Click "Generate Token" from the dropdown menu
  5. Click the "Generate Token" link that appears in a row of links
  6. Click the green "Generate token" button
  7. Click the blue "Show token" button; this is your bearer token. It will be a long string of text (over 500 characters).

NASA LAADS Bearer Token

Usage

Setup

Before downloading and extracting Black Marble data, we first load packages, define the NASA bearer token, and define a region of interest.

#### Setup
# Load packages
library(blackmarbler)
library(geodata)
library(sf)
library(terra)
library(ggplot2)
library(tidyterra)
library(lubridate)

#### Define NASA bearer token
bearer <- "BEARER-TOKEN-HERE"

### ROI
# Define region of interest (roi). The roi must be (1) an sf polygon and (2)
# in the WGS84 (epsg:4326) coordinate reference system. Here, we use the
# getData function to load a polygon of Ghana
roi_sf <- gadm(country = "GHA", level=1, path = tempdir()) 

Make raster of nighttime lights

The below example shows making daily, monthly, and annual rasters of nighttime lights for Ghana.

### Daily data: raster for February 5, 2021
r_20210205 <- bm_raster(roi_sf = roi_sf,
                        product_id = "VNP46A2",
                        date = "2021-02-05",
                        bearer = bearer)

### Monthly data: raster for October 2021
r_202110 <- bm_raster(roi_sf = roi_sf,
                      product_id = "VNP46A3",
                      date = "2021-10-01", # The day is ignored
                      bearer = bearer)

### Annual data: raster for 2021
r_2021 <- bm_raster(roi_sf = roi_sf,
                    product_id = "VNP46A4",
                    date = 2021,
                    bearer = bearer)

Make raster of nighttime lights across multiple time periods

To extract data for multiple time periods, add multiple time periods to date. The function will return a SpatRaster object with multiple bands, where each band corresponds to a different date. The below code provides examples getting data across multiple days, months, and years.

#### Daily data in March 2021
r_daily <- bm_raster(roi_sf = roi_sf,
                     product_id = "VNP46A2",
                     date = seq.Date(from = ymd("2021-03-01"), to = ymd("2021-03-31"), by = "day"),
                     bearer = bearer)

#### Monthly aggregated data in 2021 and 2022
r_monthly <- bm_raster(roi_sf = roi_sf,
                       product_id = "VNP46A3",
                       date = seq.Date(from = ymd("2021-01-01"), to = ymd("2022-12-01"), by = "month"),
                       bearer = bearer)

#### Yearly aggregated data in 2012 and 2021
r_annual <- bm_raster(roi_sf = roi_sf,
                      product_id = "VNP46A4",
                      date = 2012:2021,
                      bearer = bearer)

Map of nighttime lights

Using one of the rasters, we can make a map of nighttime lights

#### Make raster
r <- bm_raster(roi_sf = roi_sf,
               product_id = "VNP46A3",
               date = "2021-10-01",
               bearer = bearer)

#### Prep data
r <- r |> terra::mask(roi_sf)

## Distribution is skewed, so log
r[] <- log(r[] + 1)

##### Map
ggplot() +
  geom_spatraster(data = r) +
  scale_fill_gradient2(low = "black",
                       mid = "yellow",
                       high = "red",
                       midpoint = 4.5,
                       na.value = "transparent") +
  labs(title = "Nighttime Lights: October 2021") +
  coord_sf() +
  theme_void() +
  theme(plot.title = element_text(face = "bold", hjust = 0.5),
  legend.position = "none")

Nighttime Lights Map

Trends over time

We can use the bm_extract function to observe changes in nighttime lights over time. The bm_extract function leverages the exactextractr package to aggregate nighttime lights data to polygons. Below we show trends in annual nighttime lights data across Ghana's first administrative divisions.

#### Extract annual data
ntl_df <- bm_extract(roi_sf = roi_sf,
                     product_id = "VNP46A4",
                     date = 2012:2022,
                     bearer = bearer)

#### Trends over time
ntl_df |>
  ggplot() +
  geom_col(aes(x = date,
  y = ntl_mean),
  fill = "darkorange") +
  facet_wrap(~NAME_1) +
  labs(x = NULL,
       y = "NTL Luminosity",
       title = "Ghana Admin Level 1: Annual Average Nighttime Lights") +
  scale_x_continuous(labels = seq(2012, 2022, 4),
                     breaks = seq(2012, 2022, 4)) +
  theme_minimal() +
  theme(strip.text = element_text(face = "bold"))

Nighttime Lights Trends

Workflow to update data

Some users may want to monitor near-real-time changes in nighttime lights. For example, daily Black Marble nighttime lights data is updated regularly, where data is available roughly on a week delay; same use cases may require examining trends in daily nighttime lights data as new data becomes available. Below shows example code that could be regularly run to produce an updated daily dataset of nighttime lights.

The below code produces a dataframe of nighttime lights for each date, where average nighttime lights for Ghana's 1st administrative division is produced. The code will check whether data has already been downloaded/extracted for a specific date, and only download/extract new data.

# Create directories to store data
dir.create(file.path(getwd(), "bm_files"))
dir.create(file.path(getwd(), "bm_files", "daily"))

# Extract daily-level nighttime lights data for Ghana's first administrative divisions.
# Save a separate dataset for each date in the `"~/Desktop/bm_files/daily"` directory.
# The code extracts data from January 1, 2023 to today. Given that daily nighttime lights
# data is produced on roughly a week delay, the function will only extract data that exists;
# it will skip extracting data for dates where data has not yet been produced by NASA Black Marble.
bm_extract(roi_sf = roi_sf,
           product_id = "VNP46A2",
           date = seq.Date(from = ymd("2023-01-01"), to = Sys.Date(), by = 1),
           bearer = bearer,
           output_location_type = "file",
           file_dir = file.path(getwd(), "bm_files", "daily"))

# Append daily-level datasets into one file
file.path(getwd(), "bm_files", "daily") |>
  list.files(pattern = "*.Rds",
  full.names = T) |>
  map_df(readRDS) |>
  saveRDS(file.path(getwd(), "bm_files", "ntl_daily.Rds"))

Functions and arguments

Functions

The package provides two functions.

  • bm_raster produces a raster of Black Marble nighttime lights.
  • bm_extract produces a dataframe of aggregated nighttime lights to a region of interest (e.g., average nighttime lights within US States).

Both functions take the following arguments:

Required arguments

  • roi_sf: Region of interest; sf polygon. Must be in the WGS 84 (epsg:4326) coordinate reference system. For bm_extract, aggregates nighttime lights within each polygon of roi_sf.

  • product_id: One of the following:

    • "VNP46A1": Daily (raw)
    • "VNP46A2": Daily (corrected)
    • "VNP46A3": Monthly
    • "VNP46A4": Annual
  • date: Date of raster data. Entering one date will produce a SpatRaster object. Entering multiple dates will produce a SpatRaster object with multiple bands; one band per date.

    • For product_ids "VNP46A1" and "VNP46A2", a date (eg, "2021-10-03").
    • For product_id "VNP46A3", a date or year-month (e.g., "2021-10-01", where the day will be ignored, or "2021-10").
    • For product_id "VNP46A4", year or date (e.g., "2021-10-01", where the month and day will be ignored, or 2021).
  • bearer: NASA bearer token. For instructions on how to create a token, see here.

Optional arguments

  • variable: Variable to used to create raster (default: NULL). For information on all variable choices, see here; for VNP46A1, see Table 3; for VNP46A2 see Table 6; for VNP46A3 and VNP46A4, see Table 9. If NULL, uses the following default variables:

    • For product_id "VNP46A1", uses DNB_At_Sensor_Radiance_500m.
    • For product_id "VNP46A2", uses Gap_Filled_DNB_BRDF-Corrected_NTL.
    • For product_ids "VNP46A3" and "VNP46A4", uses NearNadir_Composite_Snow_Free.
  • quality_flag_rm: Quality flag values to use to set values to NA. Each pixel has a quality flag value, where low quality values can be removed. Values are set to NA for each value in ther quality_flag_rm vector. (Default: NULL).

    • For VNP46A1 and VNP46A2 (daily data):

      • 0: High-quality, Persistent nighttime lights
      • 1: High-quality, Ephemeral nighttime Lights
      • 2: Poor-quality, Outlier, potential cloud contamination, or other issues
    • For VNP46A3 and VNP46A4 (monthly and annual data):

      • 0: Good-quality, The number of observations used for the composite is larger than 3
      • 1: Poor-quality, The number of observations used for the composite is less than or equal to 3
      • 2: Gap filled NTL based on historical data
  • check_all_tiles_exist: Check whether all Black Marble nighttime light tiles exist for the region of interest. Sometimes not all tiles are available, so the full region of interest may not be covered. If TRUE, skips cases where not all tiles are available. (Default: TRUE).

  • interpol_na: When data for more than one date is downloaded, whether to interpolate NA values in rasters using the terra::approximate function. Additional arguments for the terra::approximate function can also be passed into bm_raster/bm_extract (eg, method, rule, f, ties, z, NA_rule). (Default: FALSE).

  • h5_dir: Black Marble data are originally downloaded as h5 files. If h5_dir = NULL, the function downloads to a temporary directory then deletes the directory. If h5_dir is set to a path, h5 files are saved to that directory and not deleted. The function will then check if the needed h5 file already exists in the directory; if it exists, the function will not re-download the h5 file.

  • output_location_type: Where output should be stored (default: r_memory). Either:

    • r_memory where the function will return an output in R
    • file where the function will export the data as a file. For bm_raster, a .tif file will be saved; for bm_extract, a .Rds file will be saved. A file is saved for each date. Consequently, if date = c(2018, 2019, 2020), three datasets will be saved: one for each year. Saving a dataset for each date can facilitate re-running the function later and only downloading data for dates where data have not been downloaded.

If output_location_type = "file", the following arguments can be used:

  • file_dir: The directory where data should be exported (default: NULL, so the working directory will be used)

  • file_prefix: Prefix to add to the file to be saved. The file will be saved as the following: [file_prefix][product_id]_t[date].[tif/Rds]

  • file_skip_if_exists: Whether the function should first check wither the file already exists, and to skip downloading or extracting data if the data for that date if the file already exists (default: TRUE). If the function is first run with date = c(2018, 2019, 2020), then is later run with date = c(2018, 2019, 2020, 2021), the function will only download/extract data for 2021. Skipping existing files can facilitate re-running the function at a later date to download only more recent data.

  • file_return_null: Whether to return NULL instead of a output to R (SpatRaster or dataframe). When output_location_type = 'file', the function will export data to the file_dir directory. When file_return_null = FALSE, the function will also return the queried data---so the data is available in R memory. Setting file_return_null = TRUE, data will be saved to file_dir but no data will be returned by the function to R memory (default: FALSE).

  • ...: Additional arguments for terra::approximate, if interpol_na = TRUE

Argument for bm_extract only

  • aggregation_fun: A vector of functions to aggregate data (default: "mean"). The exact_extract function from the exactextractr package is used for aggregations; this parameter is passed to fun argument in exactextractr::exact_extract.
  • add_n_pixels: Whether to add a variable indicating the number of nighttime light pixels used to compute nighttime lights statistics (eg, number of pixels used to compute average of nighttime lights). When TRUE, it adds three values: n_non_na_pixels (the number of non-NA pixels used for computing nighttime light statistics); n_pixels (the total number of pixels); and prop_non_na_pixels the proportion of the two. (Default: TRUE).

Black Marble Resources

For more information on NASA Black Marble, see:

blackmarbler's People

Contributors

g4brielvs avatar kbjarkefur avatar ramarty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blackmarbler's Issues

Problem with the bm_raster() function

Hi, since a couple of days ago I can't download any monthly data for any city. My last attempt was:

library(blackmarbler)
library(sf)
library(raster)
library(terra)
# library(lubridate) # for time-series data

wd <- "path/"

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

### ROI
roi_sf <- st_read(paste0(wd, "cairo_4326.shp"))
plot(roi_sf)

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

This gives me an error:

Error in downloading data
{"detail":"The file 'VNP46A3.A2018091.h21v05.001.2021125122242.h5' cannot be found for group 'modaps-lads' bucket 'lads-data'.","instance":null,"status":404,"title":"File Not Found","type":"urn:nasa:gsfc:tis:pinpoint:errors:file_not_found"}

No matter the date I am getting the same error. I also tried to remove the quality_flag() and change the variable but the same issue exists. A week ago, I downloaded the same image without any issue.

I have checked the shapefile's crs using the st_crs() function:

Coordinate Reference System:
  User input: WGS 84 
  wkt:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ID["EPSG",6326]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433],
        ID["EPSG",8901]],
    CS[ellipsoidal,2],
        AXIS["geodetic longitude",east,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic latitude",north,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]]]

Any ideas what is going on with the function? It might not be the package's issue but I don't know how to verify this.

The shp I am using:

roi_sf -> structure(list(Shape_Leng = 0.02124395913, Shape_Area = 2.9458e-05, 
    id = 1L, geometry = structure(list(structure(list(structure(c(31.2275546870724, 
    31.2279656516993, 31.2282594839812, 31.2294463353498, 31.2294741110967, 
    31.2302005580057, 31.2310961856922, 31.2321409013944, 31.2321758386365, 
    31.2322266723042, 31.2324640705065, 31.2321436963767, 31.2320714635903, 
    31.2319228927616, 31.2310719914295, 31.2306537880343, 31.2302945407119, 
    31.2304197926413, 31.2314285287413, 31.2322819604479, 31.2333900761167, 
    31.2333550518908, 31.2333133023017, 31.2326995466825, 31.2327834829899, 
    31.2328682053322, 31.2323023987196, 31.2311728736103, 31.2308918881443, 
    31.2297133490667, 31.2294742857831, 31.2290941593227, 31.2290725850146, 
    31.2290289123121, 31.2287850436436, 31.2284690268279, 31.2282907538421, 
    31.2280920415965, 31.2285052753408, 31.2290495258272, 31.2294279928746, 
    31.231177677513, 31.2313826733214, 31.2316384153464, 31.2331685760917, 
    31.2338387521361, 31.2339533446114, 31.2400399491509, 31.2421245842525, 
    31.2426272876749, 31.2431600321977, 31.2437815062047, 31.2442845519031, 
    31.2453660928996, 31.2455977880216, 31.2461809101194, 31.2471006948783, 
    31.2471185979516, 31.2473749172071, 31.2480817790732, 31.2497835050032, 
    31.2524292269779, 31.2555718616101, 31.2561157252908, 31.2567380042601, 
    31.2567605340883, 31.2583651181169, 31.2583992616795, 31.2590411763118, 
    31.2594554368664, 31.2597121659064, 31.2606419744356, 31.2614368640849, 
    31.2619261250365, 31.2631985607348, 31.2652179085722, 31.2675023162639, 
    31.2707653046895, 31.2719269311853, 31.2736166127285, 31.2745968648768, 
    31.2771314078665, 31.2798272411016, 31.2820951261162, 31.2824777881073, 
    31.28334813651, 31.2837649306282, 31.2842522653134, 31.2843261248949, 
    31.2845645530696, 31.284860164923, 31.2850582576276, 31.2850654165446, 
    31.2853519475535, 31.2855054273159, 31.2856406604533, 31.28573669422, 
    31.2858549029533, 31.2860518590285, 31.2861324398139, 31.2864282223293, 
    31.286759710883, 31.2872568109919, 31.2877276311387, 31.2881760128879, 
    31.2883960999529, 31.2889280262542, 31.2899066665733, 31.2903126122139, 
    31.2906278520497, 31.2926709103891, 31.2957222931755, 31.296322887865, 
    31.2970030052681, 31.2972484785883, 31.2973298373327, 31.2976532640097, 
    31.297947620782, 31.2984067006488, 31.298875817491, 31.2991685999118, 
    31.2994642622865, 31.2997199437292, 31.3000056533365, 31.3002216154634, 
    31.3007079216225, 31.3009481496527, 31.301212993516, 31.3014986994762, 
    31.3018991056645, 31.3025997913795, 31.3029592545222, 31.3034138629797, 
    31.3036324375332, 31.3040478502671, 31.3043164405812, 31.3046875952344, 
    31.3048882731376, 31.3052619573568, 31.3057899665004, 31.3058558692812, 
    31.3059484822632, 31.3062546021148, 31.3065086102746, 31.3068363760121, 
    31.3071751390511, 31.3075547515134, 31.3076423004945, 31.3077116937153, 
    31.3078788482708, 31.3080700937467, 31.3082608151904, 31.3084752782448, 
    31.3086438282971, 31.308836992817, 31.309145199985, 31.3095327490539, 
    31.3098526506519, 31.3102856729345, 31.3106393517173, 31.3109568063135, 
    31.3113137125903, 31.3116569141782, 31.3120950795404, 31.3123514317011, 
    31.3129258435453, 31.3129591857118, 31.313193104263, 31.3138592458836, 
    31.3141789610902, 31.3148709324912, 31.3153415545056, 31.3158809520322, 
    31.3163761831064, 31.3166207430375, 31.3166486727646, 31.3171226915516, 
    31.3174695418626, 31.3179251413595, 31.318417919979, 31.3190444946831, 
    31.3193267533134, 31.3197003041957, 31.3202575735702, 31.3214969974663, 
    31.3220884706085, 31.3224827843777, 31.3227004505907, 31.3228320625205, 
    31.3229833113348, 31.3231585607171, 31.3234926509536, 31.323803263253, 
    31.3240522586877, 31.3246671957262, 31.3260812070092, 31.3269207735787, 
    31.3270141553569, 31.3270740243785, 31.3271250788341, 31.3271422715286, 
    31.3271788387279, 31.3272104313805, 31.3272847002523, 31.3273621108831, 
    31.3274622995466, 31.3275528881751, 31.3276228805003, 31.3276412076592, 
    31.3276458330846, 31.3278632278717, 31.3281654504723, 31.3284947264754, 
    31.3285001373069, 31.3288131799084, 31.3288294996381, 31.3288557682904, 
    31.3291137419013, 31.3294718146046, 31.3295080319819, 31.3298018723576, 
    31.3297443610363, 31.3296347490995, 31.3296446979592, 31.3285162825388, 
    31.3285517147796, 31.3285525874929, 31.3286022449694, 31.328603990396, 
    31.328634709949, 31.3286443970756, 31.328659582305, 31.3286898654834, 
    31.3287009489513, 31.3286692694316, 31.3286437861763, 31.3286140266169, 
    31.3285779834948, 31.3285714381361, 31.3285237878911, 31.3284891410923, 
    31.3285291114602, 31.3285994522779, 31.328697719912, 31.3288178052799, 
    31.3289152000211, 31.3290896550771, 31.3292051146872, 31.3293381156369, 
    31.3295841320875, 31.3297001148314, 31.3298892301593, 31.3295645834443, 
    31.3291465558225, 31.329141930451, 31.3290314452349, 31.3289155491064, 
    31.3288259215136, 31.3288150998777, 31.328459119674, 31.3284428871618, 
    31.3282110936114, 31.3281902356557, 31.3279276346072, 31.3277917520687, 
    31.3276133678265, 31.3273153328754, 31.3272890638727, 31.3270735880129, 
    31.3270210498907, 31.3270056026318, 31.326660438773, 31.3263903287969, 
    31.3263749687284, 31.3259743843862, 31.3259697588979, 31.3256000680674, 
    31.325590031595, 31.325563762206, 31.3255012742001, 31.3251595095843, 
    31.3251078433401, 31.3247506300281, 31.3244805156412, 31.3244758900901, 
    31.3244442094205, 31.3244025794511, 31.3241270532177, 31.3239865406993, 
    31.3237218356078, 31.3232842374059, 31.323257967505, 31.3229415935641, 
    31.3226810753494, 31.3226702531385, 31.3224860135876, 31.3224043231941, 
    31.3223634779839, 31.3223017737491, 31.3221175336232, 31.3220712771683, 
    31.321826204964, 31.3218153826723, 31.3215811322385, 31.3215603603775, 
    31.3215611458733, 31.3212545423598, 31.3212777580247, 31.3212898895211, 
    31.3213035920003, 31.3212993154266, 31.3212625718432, 31.3212070636931, 
    31.321209507452, 31.3211677017721, 31.3213227056342, 31.3213440011952, 
    31.3216746055461, 31.3219174088846, 31.323315132912, 31.3250380240664, 
    31.3262618626954, 31.3274403069199, 31.3285716126787, 31.3293923981346, 
    31.3298934191472, 31.3308317478016, 31.3320509878199, 31.3332331262223, 
    31.3348309052432, 31.3353790268216, 31.3358212921216, 31.3358946828724, 
    31.3361518555453, 31.3363194058177, 31.3364553657012, 31.3365286687853, 
    31.3366283259965, 31.3367333935719, 31.3367696087124, 31.3369009430089, 
    31.3370893485688, 31.3371102049345, 31.3372252203007, 31.3373040205893, 
    31.3374245334474, 31.3377553541306, 31.3377831915378, 31.3377406936701, 
    31.3377390356406, 31.3376911273456, 31.3376915636663, 31.3376839716355, 
    31.3376591884643, 31.3376411246735, 31.3376260278743, 31.3376252424952, 
    31.3375667751059, 31.3375163360592, 31.3374542034987, 31.3373844788624, 
    31.3373547215219, 31.337892272256, 31.3381093861938, 31.33827021431, 
    31.3385127213931, 31.3385409949503, 31.3389197202814, 31.3393184277286, 
    31.3396488939905, 31.3399101597652, 31.3394741056416, 31.3392912015171, 
    31.3395024662186, 31.3395161665598, 31.339731968544, 31.3400317170855, 
    31.3410912587719, 31.3420615224537, 31.3427531543634, 31.3430603995794, 
    31.3434831767379, 31.3439410308984, 31.344503507564, 31.344819997657, 
    31.3451310768288, 31.3454925907983, 31.3457440705329, 31.346000087164, 
    31.346256103229, 31.3466409988542, 31.3470313031997, 31.3474223915409, 
    31.3478119079562, 31.3485520204595, 31.3492867183854, 31.3496436821904, 
    31.3499997723388, 31.350266599287, 31.3507128219354, 31.3510689088229, 
    31.3514296191147, 31.3517857038103, 31.3521471971635, 31.3526367776189, 
    31.3528927791313, 31.3530153699723, 31.3533327095123, 31.3537555367159, 
    31.3541116143149, 31.3547633879485, 31.3554142854282, 31.3558650254346, 
    31.3564213370613, 31.3565160040053, 31.3567107471976, 31.357506730411, 
    31.3583035806873, 31.3589608275583, 31.3596117016009, 31.3598782448162, 
    31.3598986608636, 31.3600509086585, 31.3602089146004, 31.3603465916136, 
    31.3605324291417, 31.360683716386, 31.3611374896708, 31.3616369785079, 
    31.3618224649924, 31.3618420082367, 31.3618856315408, 31.3618997654897, 
    31.3620478228324, 31.3621933498366, 31.3623098236626, 31.3624882421485, 
    31.3627007735375, 31.3628579906778, 31.3630198316265, 31.3630189591737, 
    31.3631761758828, 31.3635513314436, 31.3635642437556, 31.3636644885908, 
    31.3636886555267, 31.363692407071, 31.3637847124878, 31.3638295564946, 
    31.3639718532109, 31.3641110961852, 31.3642803512084, 31.3644097351636, 
    31.3645931233722, 31.3647527808039, 31.3648047784726, 31.3649499530676, 
    31.3650959126735, 31.3651919684758, 31.3652505965018, 31.3655357097625, 
    31.3659206290044, 31.3663132243773, 31.3666254676219, 31.3669911898572, 
    31.3673832581706, 31.367754125309, 31.3678337773981, 31.3680682840133, 
    31.3683335864935, 31.3685597169117, 31.3687740692935, 31.3690494029102, 
    31.3694924129855, 31.3699391727186, 31.3703775556707, 31.3708160242143, 
    31.3713149481188, 31.3715340063523, 31.3714876822453, 31.3714276615252, 
    31.3715738747344, 31.3715801559615, 31.3719173354683, 31.3722720489935, 
    31.3725328927217, 31.3727811735465, 31.3727883270917, 31.3745640515635, 
    31.3762421320836, 31.3766469928647, 31.3769313803316, 31.3770865718518, 
    31.3770814249723, 31.3770776738592, 31.3770867463226, 31.3770890144429, 
    31.3770881420889, 31.377077412153, 31.3770816866785, 31.3770897995525, 
    31.3770926783206, 31.377092329379, 31.3770949464319, 31.3771027103643, 
    31.3771417917235, 31.3771711027271, 31.377222396979, 31.3774663932801, 
    31.377782357706, 31.3777877662558, 31.3778386240522, 31.3779519417911, 
    31.3780753786026, 31.3781061723655, 31.3781624385589, 31.3783675264266, 
    31.3784137605673, 31.3784654032038, 31.3785679905308, 31.3786188479948, 
    31.3786604586235, 31.3789872367981, 31.3789980537808, 31.3790334706873, 
    31.3792676930307, 31.3795047936122, 31.3797465170679, 31.3797719019217, 
    31.3798919347202, 31.3799927761354, 31.3800073440515, 31.3800382245287, 
    31.3802981785296, 31.3805957291899, 31.3807777834093, 31.380866062595, 
    31.38091063832, 31.3809252061193, 31.3810035407212, 31.3811510503791, 
    31.3811902175992, 31.3812247615139, 31.381431414166, 31.3814951806902, 
    31.3814997167512, 31.3818959233066, 31.3819697212098, 31.3821800362483, 
    31.3822283624216, 31.3822337707647, 31.3825233784405, 31.3825433543673, 
    31.3828774490145, 31.3832199168494, 31.3832982498973, 31.3834157493748, 
    31.3834249085704, 31.3835277532198, 31.3836161175479, 31.3836552839415, 
    31.3838110770994, 31.3840322925561, 31.3840968427346, 31.3841306007133, 
    31.3841551995502, 31.3845222623683, 31.3845276706036, 31.3849174991026, 
    31.3849975755918, 31.3850054262295, 31.3850001052386, 31.3849849273485, 
    31.3851447312685, 31.3855184203566, 31.3857689414091, 31.3860594125635, 
    31.3866828327436, 31.3872833959651, 31.3879560056443, 31.3882794430653, 
    31.3885605747052, 31.388753170861, 31.38888121921, 31.3891976759755, 
    31.3894173983424, 31.3924036274621, 31.3939759985425, 31.3955255835682, 
    31.3958240546783, 31.3969546967618, 31.3978707678224, 31.3990289510937, 
    31.399339885448, 31.4002309933869, 31.4011637842779, 31.4020349928714, 
    31.4031649639493, 31.4035863018449, 31.4041225875086, 31.4043296355003, 
    31.4044217342327, 31.4044832205632, 31.4044710977356, 31.4044683068586, 
    31.4044600214722, 31.4044830461373, 31.4044955178257, 31.4044990064152, 
    31.404521769428, 31.4045419159988, 31.4045436602845, 31.4045453173618, 
    31.4045670337924, 31.4046095944974, 31.4046112515747, 31.4046479688824, 
    31.4046723889456, 31.4046892213348, 31.4047097167394, 31.4047239326955, 
    31.4047463468027, 31.4047754764186, 31.4047982393775, 31.4048271945585, 
    31.4048532716451, 31.4048579812246, 31.4048647839417, 31.4048730693012, 
    31.4049028093941, 31.4049404859678, 31.4049744123178, 31.4049915063144, 
    31.4050162751575, 31.4050398230015, 31.4050703479704, 31.4052303858925, 
    31.4055613628108, 31.405913095609, 31.4062657866852, 31.4065612649412, 
    31.4068567424336, 31.4071160259319, 31.4078621277547, 31.4082026904696, 
    31.4084573487401, 31.4087137506855, 31.4090272754218, 31.4094280102499, 
    31.4097937722356, 31.4101469747765, 31.4106102353487, 31.4111147442321, 
    31.4115099776605, 31.4118405878235, 31.4121615168517, 31.4125186365683, 
    31.4129401149066, 31.4132559828265, 31.4136630692107, 31.4140738168765, 
    31.4141514314518, 31.4142008780129, 31.4144265703406, 31.4147984210354, 
    31.4151294578533, 31.4154618018188, 31.4157233334319, 31.4160349206818, 
    31.4162250294835, 31.4164096440093, 31.4164773155818, 31.4164948439049, 
    31.4165139419351, 31.4165266739463, 31.4165426325623, 31.4165517891438, 
    31.4164223760384, 31.4162994159988, 31.4162098556717, 31.4160640474679, 
    31.4159601851711, 31.4158604214646, 31.4157763547757, 31.4156793815151, 
    31.4156323773565, 31.4155452582821, 31.4154418315603, 31.4153217482945, 
    31.4150891683859, 31.4148154263773, 31.4147571721852, 31.4153129404389, 
    31.4157153976698, 31.4162184018391, 31.4163131073029, 31.4169861591868, 
    31.4170758061294, 31.4173484091371, 31.4177011526299, 31.418385881813, 
    31.419309980749, 31.419917961791, 31.4202597971221, 31.4208989044024, 
    31.4209322156669, 31.4215131556401, 31.421724532649, 31.4219405309601, 
    31.4219459374527, 31.4221137130045, 31.4222208834283, 31.4225625375602, 
    31.4226982222808, 31.4228365228685, 31.4230008963027, 31.4231773903817, 
    31.4232583996725, 31.4233132487825, 31.4233814395185, 31.4234808479502, 
    31.4236364132414, 31.4238793528004, 31.4240661351316, 31.424329129714, 
    31.4245433791759, 31.4248462227729, 31.4249987342592, 31.4252412349642, 
    31.4255127723633, 31.4257816931676, 31.4258576431288, 31.4266949205484, 
    31.4271673578873, 31.4275143164632, 31.4280952234054, 31.4287544297984, 
    31.4293716040283, 31.4300634142266, 31.430480468964, 31.43134395846, 
    31.4320099474748, 31.4329780574188, 31.433062634773, 31.4330837355073, 
    31.4330903621815, 31.4362391236383, 31.4388326698173, 31.4414461235883, 
    31.441471059006, 31.4415633897733, 31.4422244374971, 31.4528566552657, 
    31.4541517671187, 31.4563853999015, 31.45818050425, 31.4605397617002, 
    31.4634105740056, 31.4634236495325, 31.4441090392367, 31.4434588132656, 
    31.4427489485471, 31.4417512769695, 31.4406643169399, 31.4394939947253, 
    31.4389443585693, 31.4382319376408, 31.4375654613169, 31.4367755197229, 
    31.4357032482083, 31.4350500976281, 31.4344140330135, 31.4331753754252, 
    31.432338755249, 31.4334147200522, 31.4340828769443, 31.4354825672581, 
    31.4367631387015, 31.4368152785016, 31.4368323678, 31.4369078745504, 
    31.438528293425, 31.4399981162012, 31.4407047718771, 31.4429030057825, 
    31.4444236015272, 31.4455138391858, 31.4468412909999, 31.4488299990458, 
    31.449360931487, 31.4497246493113, 31.4481389114074, 31.4462184559285, 
    31.4435040624126, 31.4407802761031, 31.4380580822012, 31.4353633766931, 
    31.4333276143537, 31.4337209409463, 31.4354183944439, 31.4358394406746, 
    31.433300235779, 31.4512763654912, 31.4847530084353, 31.4990104423553, 
    31.5131103145324, 31.5352145848759, 31.536873518174, 31.5379756854236, 
    31.5382527065075, 31.5383766688694, 31.5384335538673, 31.5382974828083, 
    31.5368179391109, 31.5356816114822, 31.5334548331055, 31.529913555615, 
    31.5251760578486, 31.5232406825206, 31.5233644868868, 31.5224161298718, 
    31.516721030905, 31.5150759210712, 31.5132275949018, 31.5097356209515, 
    31.5076357324834, 31.5041159652512, 31.4983507659997, 31.4983857106439, 
    31.4984197838324, 31.4987271392718, 31.4991746201365, 31.498953973511, 
    31.496234983217, 31.4962262686783, 31.4970058685075, 31.5025344616641, 
    31.5038874855589, 31.5039673053635, 31.5040447723545, 31.4895341810152, 
    31.4814934002982, 31.4577231876774, 31.4468344035627, 31.4468607327435, 
    31.4469793883528, 31.447140850455, 31.447804394561, 31.4225758793209, 
    31.4189496554213, 31.3955771313785, 31.3788610966955, 31.3758192120121, 
    31.3744209826464, 31.3739878491704, 31.3735535799903, 31.3728877788491, 
    31.3714640403657, 31.3707024378162, 31.3692692505741, 31.3680283271921, 
    31.3661483344836, 31.364107606392, 31.3626731165569, 31.3624078884302, 
    31.3613765466034, 31.3593437618018, 31.3582481773886, 31.357651914097, 
    31.35698357906, 31.35636776514, 31.3559518402407, 31.3555041543624, 
    31.3547638242063, 31.3538327553049, 31.3521489422487, 31.3519165849516, 
    31.3505899669088, 31.3499229002391, 31.3491075816605, 31.3489830670773, 
    31.3487990435172, 31.3486707765723, 31.3484097049145, 31.3480765584841, 
    31.3477434111014, 31.3464667445178, 31.345491020139, 31.3446753215641, 
    31.343534747599, 31.3418157067946, 31.338181204749, 31.336555982897, 
    31.3331256119864, 31.3297572770854, 31.328690825468, 31.3274428378154, 
    31.326398096098, 31.3233304061044, 31.3228419246838, 31.3221957331634, 
    31.3213517688376, 31.3196579743039, 31.3170750366445, 31.316685330523, 
    31.3147830397876, 31.3138008538989, 31.3106556739802, 31.3075941180068, 
    31.3044469384113, 31.3033517123091, 31.3020278603588, 31.3004421164091, 
    31.299700564688, 31.2996356186758, 31.2995806240387, 31.2995302559139, 
    31.2994798877622, 31.2993333224404, 31.2992092786283, 31.2989332566776, 
    31.2987038489358, 31.2985805900985, 31.2984519189116, 31.298319581242, 
    31.2981916954162, 31.2968102577282, 31.2951694465306, 31.2941369004672, 
    31.2927891121335, 31.2919389124127, 31.2918560658425, 31.291784044277, 
    31.2916687223877, 31.2913139388029, 31.2912606862506, 31.2911811565749, 
    31.291107825104, 31.2910345808955, 31.2909621223265, 31.2908841638402, 
    31.2908125781822, 31.2907201278491, 31.2906493277858, 31.2905776546768, 
    31.2903353102067, 31.2901645513408, 31.2900491405542, 31.2899400152796, 
    31.2898254772781, 31.2893969190745, 31.2885113377599, 31.2875063205863, 
    31.2862113617883, 31.2851179734685, 31.2837867568419, 31.2834593632405, 
    31.2824963842488, 31.281330147617, 31.2798323049498, 31.2790728994639, 
    31.2790237448553, 31.2789691771065, 31.2789317217879, 31.2788842259903, 
    31.2788438021529, 31.2788133314781, 31.2787783207538, 31.2787595494139, 
    31.2787371111061, 31.2787245386717, 31.27871825245, 31.278716593585, 
    31.2787140616385, 31.2787231417285, 31.2793614531733, 31.2714288930914, 
    31.2703640065279, 31.2705379374978, 31.2707839899977, 31.2709733749819, 
    31.2709950289437, 31.2710328360426, 31.2708203128193, 31.2701100074861, 
    31.2693318536751, 31.2685028767067, 31.2682635427966, 31.2677937798142, 
    31.2657929876221, 31.2656710040422, 31.2654018014454, 31.2652407860484, 
    31.2650734834775, 31.2649070538535, 31.2647414098691, 31.2642366177738, 
    31.2637310376405, 31.2632491190778, 31.2632179458037, 31.2627626578785, 
    31.2626681771193, 31.2626032979508, 31.2625330048787, 31.2624626244453, 
    31.2623969592779, 31.2623312067583, 31.2622654542028, 31.262205115506, 
    31.2621447767823, 31.2620827789241, 31.2620224401285, 31.2619870751177, 
    31.2619658561112, 31.2618976583594, 31.2618669213341, 31.2618457023007, 
    31.2459822279853, 31.2450474131271, 31.2444152037045, 31.2411817038795, 
    31.238271443343, 31.2359472533098, 31.2345617658907, 31.2325840795625, 
    31.2330064685589, 31.2336017934165, 31.2333991597102, 31.2333936571518, 
    31.2333881545934, 31.233297930061, 31.2331480506385, 31.233144294917, 
    31.2330150281202, 31.2326630374246, 31.2320477062412, 31.231226328023, 
    31.2310187989745, 31.2301029067505, 31.230065872616, 31.2300296245792, 
    31.2296987624567, 31.2296757907382, 31.2296466175271, 31.2296430363843, 
    31.2291527680529, 31.2290235842424, 31.2275825506026, 31.2275546870724, 
    30.0063776183823, 30.0083113594771, 30.0097023456009, 30.0142993258813, 
    30.0144138484228, 30.0181797090103, 30.0215087388447, 30.0248803687122, 
    30.0250033124564, 30.025677625072, 30.02871423907, 30.0304233409141, 
    30.0308008203268, 30.0312036723312, 30.0334387334802, 30.0357544126049, 
    30.0369334043795, 30.0380700669361, 30.0394315167588, 30.0405808655214, 
    30.0425869583216, 30.0445634473033, 30.0467264624436, 30.0490380488528, 
    30.0496318182595, 30.0502849612669, 30.0515149866293, 30.053958052844, 
    30.0545687870696, 30.0565410774155, 30.0575590519426, 30.0591835763247, 
    30.0603160529926, 30.0626616435369, 30.0658088879368, 30.0680908950246, 
    30.0693634321247, 30.0708352976788, 30.0727482929187, 30.0744449818872, 
    30.0756285109535, 30.0797684906346, 30.0802605644539, 30.0806805102843, 
    30.0832044133582, 30.0855417108175, 30.0859319596382, 30.0971988857988, 
    30.1009702208095, 30.1018737976699, 30.1038675828949, 30.1051827623928, 
    30.1053439144594, 30.1056917820496, 30.1057681348333, 30.1059505356586, 
    30.1062475400265, 30.1062560695751, 30.1063196671441, 30.1064978588593, 
    30.1070238913949, 30.1078044965107, 30.1086317233812, 30.1086698999572, 
    30.1088862875173, 30.108890502727, 30.1092256431928, 30.1092341727683, 
    30.1093571110238, 30.1094250415268, 30.1094631857365, 30.1095905099894, 
    30.109692313159, 30.1097559312545, 30.1099171211223, 30.1101844442459, 
    30.1105874521979, 30.1109522520969, 30.1111007851515, 30.1113171193696, 
    30.1114529236918, 30.1118049776468, 30.1121783132658, 30.1125516564306, 
    30.1126789146843, 30.1130267845023, 30.1132177299409, 30.1134637964186, 
    30.1135358826898, 30.1137564965807, 30.113964406434, 30.1143377154808, 
    30.1143462125553, 30.1147831598379, 30.1150673918153, 30.1155340885692, 
    30.1159116322743, 30.1164291896633, 30.1169892348051, 30.117260737646, 
    30.1180201618887, 30.1190426175269, 30.1204935129258, 30.1218936049842, 
    30.1233445365133, 30.1241591421799, 30.1258137452839, 30.1288556984907, 
    30.130200630056, 30.1311127607195, 30.1306460828661, 30.1297975343386, 
    30.1296278495254, 30.1294496964018, 30.1294581452457, 30.1294581516327, 
    30.1295048358563, 30.1296236295815, 30.1298909106371, 30.1302091167728, 
    30.1304296906258, 30.1306927771509, 30.1309175915461, 30.131129722026, 
    30.1312909905143, 30.1316685975146, 30.1318977200144, 30.132114081146, 
    30.1323813634861, 30.1327631636965, 30.13334870458, 30.133632959222, 
    30.1340147761949, 30.1341887284818, 30.1345366618376, 30.1347445603632, 
    30.135033081329, 30.1351985160779, 30.1354997569815, 30.1359792178254, 
    30.1360386111262, 30.1361234445991, 30.1363568442563, 30.1365180145139, 
    30.1367513997352, 30.1370398896643, 30.1375363197019, 30.1380072448887, 
    30.1383042544489, 30.138877068801, 30.1393522220704, 30.1396322416409, 
    30.1398952906972, 30.140090502325, 30.1402729513899, 30.1404892851049, 
    30.1407778558015, 30.1410536212024, 30.1414354925233, 30.1417452013241, 
    30.1419530548082, 30.1421143488535, 30.1422331395784, 30.1422840508245, 
    30.1422924888168, 30.142292506837, 30.1422967744814, 30.1423009925567, 
    30.1423264583847, 30.1423264723715, 30.1423180047707, 30.1423137276042, 
    30.1423010247074, 30.1422840592058, 30.1421780028637, 30.142182193271, 
    30.142250070432, 30.1422501135241, 30.1422798235235, 30.1423052542902, 
    30.1423774236376, 30.1424071245819, 30.1424325122744, 30.1424282912705, 
    30.1424749516708, 30.1424791916022, 30.1424452756458, 30.1439600106198, 
    30.1451480297354, 30.1464633311616, 30.1479822498953, 30.1495649444778, 
    30.1509184148892, 30.1519325542299, 30.151945270835, 30.1519155164319, 
    30.151885870186, 30.1522761990375, 30.1530187735356, 30.1539904317711, 
    30.1545717155835, 30.1548390365242, 30.1551360362748, 30.1556494583322, 
    30.155959220484, 30.1560822377373, 30.156184103223, 30.1565107986898, 
    30.1569054245157, 30.1569563340282, 30.1571515159217, 30.157117561706, 
    30.1570835840892, 30.1570836587841, 30.1570496938426, 30.1570496571374, 
    30.1570454053303, 30.1570072228703, 30.1569266477533, 30.1569181014422, 
    30.1568417532938, 30.1572915221766, 30.1577243261955, 30.1580765531929, 
    30.1582080684819, 30.1586068790827, 30.1586111642801, 30.1590821116464, 
    30.159090602774, 30.1593833836138, 30.1595149529993, 30.159646494546, 
    30.1599095210456, 30.1601853879022, 30.1605460042571, 30.1608557821294, 
    30.161144348532, 30.1613734137821, 30.1614498543671, 30.161785060922, 
    30.1621032809008, 30.1624427287794, 30.1626888194577, 30.1629943110995, 
    30.1633550350276, 30.1636563183677, 30.1641824206664, 30.1645473728658, 
    30.1649462663541, 30.1657524221887, 30.166147095778, 30.1667750658352, 
    30.1672715317066, 30.1673776485862, 30.1673818822653, 30.1673988219314, 
    30.1674158456707, 30.1674285366469, 30.1674285465283, 30.167492187504, 
    30.1674922022633, 30.1675261693249, 30.1675304177094, 30.1675728481227, 
    30.1675982456247, 30.1676279900475, 30.1676831166023, 30.1676873697209, 
    30.1677212970051, 30.1677298031345, 30.1677340464795, 30.167797752017, 
    30.167857137233, 30.1678613574373, 30.1679462121464, 30.1679504457805, 
    30.1680268129193, 30.1680311305459, 30.1680353040918, 30.1680480249459, 
    30.1681286519676, 30.1681414423244, 30.1682262322828, 30.1682856930111, 
    30.1682899266184, 30.1682941839052, 30.1683026564376, 30.168362041986, 
    30.1683917484549, 30.1684512029849, 30.1685402885972, 30.1685445409074, 
    30.1686166251663, 30.1686973115217, 30.1686973208373, 30.1687524512008, 
    30.1687779321654, 30.168790633014, 30.1688075813488, 30.1688627905126, 
    30.1688754959157, 30.1689518588144, 30.1689518680491, 30.1690283005582, 
    30.1690325248679, 30.1690367538218, 30.1692404581672, 30.169495051229, 
    30.1695841413239, 30.1699278420068, 30.1702079242348, 30.17054317434, 
    30.1708104191934, 30.1708232412786, 30.1710778312682, 30.1713409118374, 
    30.1713663372052, 30.1717779567489, 30.1726775124088, 30.172427154634, 
    30.1721216858364, 30.1718967515161, 30.1716887986245, 30.1714894171699, 
    30.1713366610903, 30.1712390037536, 30.171077803672, 30.1708571049531, 
    30.1706407396174, 30.1703606719331, 30.1702545677467, 30.1701612549142, 
    30.1701484938605, 30.1701060463253, 30.1700763759596, 30.1700508641559, 
    30.170038205043, 30.1700211879332, 30.1700042445032, 30.1699957726445, 
    30.1699744941785, 30.1699405725806, 30.1699363223186, 30.1699151622686, 
    30.1699023949267, 30.1698811269081, 30.1697453614469, 30.1692828997645, 
    30.1689858328828, 30.1689773200609, 30.168680337037, 30.168654872269, 
    30.1686166387219, 30.1684638903857, 30.1683450910011, 30.1682687589955, 
    30.168264451412, 30.1678316298041, 30.167521925387, 30.1671527316393, 
    30.1666902459269, 30.166210768563, 30.1659136916292, 30.165833044045, 
    30.1657694253297, 30.1656251809131, 30.1656039172244, 30.1653536069795, 
    30.1651498970736, 30.1649844403789, 30.1648528965415, 30.1645388981145, 
    30.1643267379274, 30.1641612095022, 30.1641484749578, 30.1639787356348, 
    30.1639872881084, 30.1641102687823, 30.1642206529649, 30.1642376008326, 
    30.1642291068484, 30.1642290961045, 30.164297036983, 30.1643734132666, 
    30.16441157953, 30.1644497503118, 30.1644964370687, 30.1645346124409, 
    30.1645685761967, 30.164602539153, 30.1646576871954, 30.1647128276111, 
    30.1647722735083, 30.1648231821044, 30.1649207972294, 30.16501833253, 
    30.1650692913869, 30.1651159645612, 30.1651499031821, 30.1652135904479, 
    30.1652602590588, 30.1653026921132, 30.1653493576787, 30.1653960155997, 
    30.1654596996585, 30.165493642232, 30.1655106193938, 30.165553037572, 
    30.1656081652765, 30.1656549001382, 30.1657439920387, 30.1658287949239, 
    30.1658882434711, 30.1659603738675, 30.1659730938862, 30.1659985272131, 
    30.1661046227667, 30.1662149944807, 30.1663041030898, 30.1663889524539, 
    30.1658458375459, 30.1658118386211, 30.1655402464068, 30.1652432883919, 
    30.1649801476625, 30.1645770501306, 30.1642460690711, 30.1633889864316, 
    30.1624342543156, 30.1620565929941, 30.1620183892351, 30.1619377706306, 
    30.1618995733843, 30.1616068306511, 30.1613012924586, 30.1610679210354, 
    30.1607369608798, 30.1603593448244, 30.160058076594, 30.1597525739748, 
    30.1597482901608, 30.1594470215441, 30.1587681289489, 30.1587511656033, 
    30.1585729408301, 30.1585305025835, 30.1585220637558, 30.1583310499913, 
    30.1582292757385, 30.1579618968294, 30.1576521580069, 30.1573297200067, 
    30.1570793831717, 30.1567186678494, 30.1564302158472, 30.1563368439954, 
    30.1560568204633, 30.1557810245287, 30.1555815707059, 30.1554670370343, 
    30.1550724154753, 30.15482625922, 30.154728723587, 30.154745690436, 
    30.1548135249271, 30.1549874893682, 30.1551912229897, 30.1552378531706, 
    30.155382168599, 30.1555179317425, 30.1556197109719, 30.1557173211651, 
    30.1558488398677, 30.156061018623, 30.1562646758158, 30.1564810816925, 
    30.1566974608893, 30.156918101038, 30.1570666483578, 30.1573806049682, 
    30.1577073762886, 30.157953467497, 30.157957664947, 30.1582377650784, 
    30.1584965852257, 30.158691796, 30.1588784521629, 30.1588869328969, 
    30.1602744788235, 30.1615516632769, 30.1618996401202, 30.1622135573934, 
    30.1637920348886, 30.1661216210388, 30.1672800599526, 30.1684214704917, 
    30.1685147944723, 30.169113182037, 30.1703182702749, 30.1715445562921, 
    30.1734201415334, 30.1739547952456, 30.1742815534148, 30.1749520071374, 
    30.1754018141626, 30.1761740997469, 30.1771161403209, 30.1787710705374, 
    30.179373650845, 30.1793269712477, 30.1793269632078, 30.1793100000059, 
    30.1792802839518, 30.1792463812995, 30.1792379031615, 30.1792209318119, 
    30.1791615082558, 30.1791487793977, 30.1791360424638, 30.1791063189538, 
    30.1790893555093, 30.1790808611119, 30.1789790476655, 30.1789790314779, 
    30.1789663186188, 30.1788899066092, 30.1788007739072, 30.1787074063493, 
    30.1786989360087, 30.1786480372312, 30.1786098270312, 30.1786013729232, 
    30.1785928712853, 30.1784825549705, 30.1783424761137, 30.1782491639639, 
    30.1782024838816, 30.1781812454714, 30.1781727913005, 30.1781303307668, 
    30.178053934837, 30.1780327045297, 30.1780157879863, 30.177909699179, 
    30.1778756926814, 30.1778714812356, 30.1776550450677, 30.1776168748518, 
    30.1775022914674, 30.1774726149483, 30.1774726067377, 30.177319821373, 
    30.1773113588837, 30.177137357423, 30.1769506830423, 30.176908221727, 
    30.1768445297091, 30.176836083632, 30.176780948193, 30.176734243919, 
    30.1767130131984, 30.1766238870362, 30.1765093414888, 30.1764796397899, 
    30.176458417262, 30.1764457200067, 30.1762462672528, 30.1762462589703, 
    30.1765177876917, 30.1768403060732, 30.1772901375146, 30.1776465364499, 
    30.1780624025455, 30.1784316419636, 30.1785122452698, 30.1784358528344, 
    30.1783425338664, 30.1781515211979, 30.1779818475867, 30.1777654341551, 
    30.1776465824796, 30.1774513697828, 30.1771925286419, 30.176963391302, 
    30.1777398918985, 30.178274633448, 30.1775065596598, 30.177043989389, 
    30.1766578314961, 30.1765772508724, 30.17629291328, 30.1760467870643, 
    30.1757370708345, 30.1756648935011, 30.1754569609563, 30.1752404981624, 
    30.1766832806334, 30.1784740726194, 30.1791233186812, 30.1798871052059, 
    30.1803030166574, 30.180740080685, 30.1813511311355, 30.181618466593, 
    30.1816863451644, 30.1819452197316, 30.1822253177071, 30.182479950699, 
    30.1825520214832, 30.1829678876327, 30.1832607018808, 30.1833243678656, 
    30.183332874552, 30.1835789562921, 30.1838208527543, 30.1838293594048, 
    30.1840967153439, 30.1844659010517, 30.1847968804133, 30.1850642633018, 
    30.1853272948949, 30.1857686581247, 30.1862439434375, 30.1866046165659, 
    30.1869695832551, 30.1873472671064, 30.1873981897522, 30.187487349727, 
    30.1876655769886, 30.1879795852341, 30.1883063702988, 30.1886415914244, 
    30.1888919767594, 30.1892357222862, 30.1895455112796, 30.1898637397654, 
    30.1902881200124, 30.1902074909426, 30.1901226193183, 30.1900420047472, 
    30.1899741183695, 30.1899062313719, 30.1898467616425, 30.1896728164253, 
    30.1896133849372, 30.1895582269324, 30.1895115512428, 30.189507267303, 
    30.1895327970101, 30.1895455199753, 30.1895497000609, 30.1895624278499, 
    30.1895369717867, 30.1895072695308, 30.1894521288725, 30.189375728586, 
    30.1892909081656, 30.1892017479662, 30.1890999306481, 30.1889386704872, 
    30.1887137399668, 30.1885312479804, 30.1884251844427, 30.1882511983522, 
    30.188212966979, 30.1881875478904, 30.1881959788039, 30.1882299359032, 
    30.188297863307, 30.1882724089775, 30.1882469088159, 30.1887519657704, 
    30.1892229942545, 30.189647374232, 30.1899570762865, 30.1904748263731, 
    30.190958599885, 30.1915357612656, 30.192036560044, 30.1922953642731, 
    30.1928173472573, 30.1932502203207, 30.1936491532541, 30.1939631754684, 
    30.1942941602649, 30.194548787831, 30.1948203985506, 30.1952277424728, 
    30.1954697127676, 30.1957455093849, 30.19611471782, 30.1963948118699, 
    30.1963268840798, 30.19636084868, 30.1964372976912, 30.1964499887033, 
    30.1964542090065, 30.1964414871013, 30.1963948285156, 30.1963693171341, 
    30.1963778661761, 30.1963906018883, 30.1963948218501, 30.1963693469941, 
    30.1964754776449, 30.1964796917407, 30.1964839566901, 30.1964839403318, 
    30.1964796882193, 30.1964796771431, 30.1961232502971, 30.1958983261367, 
    30.1950792864667, 30.1947525152181, 30.1944384261422, 30.1940650116242, 
    30.1936703302913, 30.193504832364, 30.1933987619902, 30.1933053751814, 
    30.1931780512069, 30.1929786628263, 30.192673114456, 30.1924397095346, 
    30.1921255889637, 30.1918667621689, 30.1914805538087, 30.1912386772351, 
    30.1909034811456, 30.1909331582576, 30.1909501520382, 30.1909501649111, 
    30.1909628769437, 30.1909671302151, 30.1909671109282, 30.190971360265, 
    30.1909883684545, 30.190984083293, 30.1910010478244, 30.1910264837295, 
    30.1909798644361, 30.1910307414654, 30.1909925635509, 30.1850812038303, 
    30.1834389141226, 30.1829806647034, 30.1813936057549, 30.1800950361157, 
    30.1787880437286, 30.1787499156796, 30.1786140949361, 30.1776295931636, 
    30.1672375914598, 30.1673182195864, 30.1674582314018, 30.1675728265541, 
    30.167717078229, 30.1678995359088, 30.1606181093839, 30.1545292343974, 
    30.1543383213789, 30.1541474065639, 30.1538715738163, 30.1535830972812, 
    30.1532563317818, 30.1531078517638, 30.1529041828479, 30.1527132448114, 
    30.1525010859897, 30.1522040279744, 30.1520258330702, 30.1518518831997, 
    30.1515082204437, 30.1512791007737, 30.1497898143799, 30.1471719214672, 
    30.1424197834073, 30.1413336346104, 30.1413505937879, 30.1413548460351, 
    30.1413803291826, 30.1396577237284, 30.1381048520007, 30.1373496500823, 
    30.1353979275092, 30.134375480432, 30.1336965692866, 30.1323007642313, 
    30.1299206072246, 30.1272392074547, 30.1246978954617, 30.122135419565, 
    30.1199886766963, 30.1167050159789, 30.1137013509638, 30.1108419950349, 
    30.1062857037926, 30.1011695902266, 30.0970758873112, 30.092426552722, 
    30.0866362035621, 30.081681608818, 30.084269195825, 30.0890795250601, 
    30.0871876460953, 30.0894783023603, 30.0935294515866, 30.087853590347, 
    30.0827293255401, 30.0796454745491, 30.0769095026197, 30.072659213936, 
    30.0712891455507, 30.064833369892, 30.0619405907596, 30.0580807839375, 
    30.0524226430808, 30.0477783207495, 30.0454964631234, 30.0453013942469, 
    30.0445591668848, 30.0400803896784, 30.0384984591849, 30.0378325561838, 
    30.0360852389925, 30.0351055260848, 30.0335999162513, 30.0311442912745, 
    30.031101907897, 30.031055241487, 30.0306650753113, 30.0299695336101, 
    30.0278660134509, 30.027781161365, 30.0243374739993, 30.0218692299565, 
    30.0163306583047, 30.0128998750494, 30.0091086497842, 30.0040707056829, 
    30.004070679003, 30.0015432885973, 30.0013990879376, 30.0011489415275, 
    29.9999360968762, 29.9946015633028, 29.9872020331655, 29.9753928834503, 
    29.9742819587225, 29.974120797026, 29.9730861744978, 29.9723442099109, 
    29.9722085486364, 29.9721448869456, 29.9720898024859, 29.972055871312, 
    29.9720007199009, 29.971835408365, 29.9716784725501, 29.9713816653085, 
    29.9711272855068, 29.970732974145, 29.9702919449807, 29.9699612324636, 
    29.9699061203628, 29.9696983236254, 29.9692149957677, 29.9690666025449, 
    29.9690072438472, 29.9689393643506, 29.9688631018027, 29.9688121694461, 
    29.9687655645617, 29.9686892061815, 29.9685789795544, 29.9683839693379, 
    29.9683585378885, 29.9682185891168, 29.9681295291334, 29.968112619507, 
    29.9681126060323, 29.9681125748248, 29.9681210851764, 29.9681422362703, 
    29.968210067698, 29.9682779776296, 29.96844753649, 29.9685790023087, 
    29.9686977074511, 29.9688715719906, 29.9691598822206, 29.9696177883486, 
    29.9696940811697, 29.9698128290988, 29.9699442895277, 29.9699994475953, 
    29.9700672671204, 29.9700672568257, 29.9701859924748, 29.9701520887804, 
    29.9701138611532, 29.9699231130923, 29.9694566551017, 29.9687061998363, 
    29.9685959478049, 29.9680320004085, 29.9677436959995, 29.9664716688101, 
    29.965267499414, 29.9640124494762, 29.9635885111015, 29.9630754524036, 
    29.9626345135918, 29.9626344842528, 29.9626345101063, 29.9626302516697, 
    29.9626217608744, 29.9626132700433, 29.9625835879905, 29.9625581374609, 
    29.9625030787649, 29.9624648772607, 29.9624436625481, 29.9624225224586, 
    29.9624097260472, 29.9623928223946, 29.9622486135244, 29.9620790462378, 
    29.9619476024996, 29.9617822464701, 29.9616974808291, 29.9616889558619, 
    29.9616805200167, 29.9616720447084, 29.9616847248239, 29.9616889688965, 
    29.9616974253312, 29.9617102031564, 29.9617228786366, 29.9617398705756, 
    29.9617568011148, 29.9617780071676, 29.9618034304603, 29.9618288735968, 
    29.9618501025028, 29.9619391466489, 29.9620069847242, 29.9620536019424, 
    29.9621045176622, 29.9621553489673, 29.962371602355, 29.9628253187315, 
    29.9632492537376, 29.9637962383003, 29.9643220325488, 29.9649325684982, 
    29.9650852262123, 29.9655303695708, 29.9660434656297, 29.9667430033876, 
    29.9670950066506, 29.9671203876597, 29.967145842609, 29.9671755282281, 
    29.9672094404475, 29.967251809955, 29.9672900551623, 29.9673324300687, 
    29.9673748211897, 29.9674257151792, 29.9674723491061, 29.9675232028871, 
    29.9675698246508, 29.9676122319325, 29.967658887401, 29.9689563147425, 
    29.969664439092, 29.9697832053647, 29.9705887895563, 29.9717633194977, 
    29.9723992836716, 29.9724544604062, 29.9725646723638, 29.9726961584575, 
    29.9720261641154, 29.9713689853008, 29.9706735605244, 29.9704743262947, 
    29.9700927183957, 29.968443295274, 29.9683458254426, 29.9681041031817, 
    29.9679726816589, 29.9678369589935, 29.9677055299608, 29.9675783381734, 
    29.9671839822014, 29.9667854612085, 29.9664250825478, 29.9664038274919, 
    29.9660689070684, 29.966001027949, 29.9659459279934, 29.9658908215879, 
    29.9658356586335, 29.9657763202377, 29.965716925293, 29.9656576095977, 
    29.9655982207795, 29.9655389112197, 29.9654710688953, 29.9654116797358, 
    29.9653693019728, 29.9653438435469, 29.9652717563415, 29.965225146696, 
    29.9651996881804, 29.9631899286908, 29.9645001044916, 29.9650597818361, 
    29.9679302614415, 29.9710424849482, 29.9734975083772, 29.9762959797749, 
    29.9808839005547, 29.9812443627587, 29.9823511066552, 29.9835849856284, 
    29.9836952513772, 29.983805517063, 29.9860019595751, 29.9874224602248, 
    29.9874309864855, 29.9886521612325, 29.9911710100163, 29.9930070998649, 
    29.9946482138306, 29.9953309032632, 29.9954369041343, 29.9954411501653, 
    29.9954496344926, 29.9956955509337, 29.9957168205243, 29.9957337654635, 
    29.9960475794663, 29.9982738481838, 29.9988590550648, 30.0048043448904, 
    30.0063776183823), dim = c(1049L, 2L))), class = c("XY", 
    "POLYGON", "sfg"))), n_empty = 0L, crs = structure(list(input = "WGS 84", 
        wkt = "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n            LENGTHUNIT[\"metre\",1]],\n        ID[\"EPSG\",6326]],\n    PRIMEM[\"Greenwich\",0,\n        ANGLEUNIT[\"degree\",0.0174532925199433],\n        ID[\"EPSG\",8901]],\n    CS[ellipsoidal,2],\n        AXIS[\"geodetic longitude\",east,\n            ORDER[1],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        AXIS[\"geodetic latitude\",north,\n            ORDER[2],\n            ANGLEUNIT[\"degree\",0.0174532925199433]]]"), class = "crs"), class = c("sfc_POLYGON", 
    "sfc"), precision = 0, bbox = structure(c(xmin = 31.2275546870724, 
    ymin = 29.9616720447084, xmax = 31.5384335538673, ymax = 30.1964839566901
    ), class = "bbox"))), row.names = c(NA, -1L), class = c("sf", 
"data.frame"), sf_column = "geometry", agr = structure(c(Shape_Leng = NA_integer_, 
Shape_Area = NA_integer_, id = NA_integer_), class = "factor", levels = c("constant", 
"aggregate", "identity")))

R 4.3.2, RStudio 2023.12.1 Build 402, Windows 11.

Input checks

  • If output type is "file", make sure "file_dir" exists (also default file_dir to wd?)

Update "About" description on github

@g4brielvs Could we update the "About" section on Github? I think this is done through "settings", but I don't have access to that on World Bank repos.

Right now it reads:
Create Georeferenced Rasters of Nighttime Lights from NASA Black Marble data

Which summarizes the bm_raster function, but not bm_extract. So maybe we change to something more general -- like:

Facilitate analysis of NASA Black Marble data

https://worldbank.github.io/blackmarbler/

Weighted Average using "Mandatory_Quality_Flag" when using bm_extract function

In the function bm_extract we can remove cells with specified quality flags (vector) using the parameter quality_flag_rm.
Once you migrate to terra, using a weighted average considering quality flag values for each cell would be nice. For instance, add more weight to high-quality cells if the selected function is mean. Or even better have access to other bands different than variable to write personalized functions cell-by-cell like weighted average.

Best

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

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

Function blackmarbler::bm_extract is not downloading

Can you please advise me on why the function blackmarbler::bm_extract is not downloading the files as expected? Despite the system indicating that the files were processed 100%, no downloads are appearing in my designated folders. I used a local Administrator account on Windows 10 to run the R script, but no files are being written to the disk drive. I did not encounter any error messages or warnings during the execution of the script. I just installed the development version of blackmarbler package from GitHub, but It didn't work with the CRAN version either. I'm running the last R version [4.3.3]. Any assistance in resolving this issue would be greatly appreciated. I am using my NASA-EARTHDATA-TOKEN to define the bearer variable.

library(sf)
library(dplyr)
library(ggplot2)
library(purrr)
library(lubridate)
bearer <- "NASA-EARTHDATA-TOKEN"
#test
roi_sf <- gadm(country = "GHA", level = 1, path = tempdir()) |> st_as_sf()
blackmarbler::bm_extract(
  roi_sf = roi_sf,
  product_id = "VNP46A2",
  date = seq.Date(
    from = lubridate::ymd("2023-01-01"),
    to = lubridate::ymd("2023-01-02"), by = 1
  ),
  bearer = bearer,
  output_location_type = "file",
  file_dir = file.path(getwd())
)

This is the outcome:
error

`bm_raster` returns `NULL`

This has been the case for a month or so now. I've updated to the dev version but the problem persists. It seems unrelated to the sf object that I pass.

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)

Produces:

Processing 2 nighttime light tiles
Processing: VNP46A4.A2021001.h17v03.001.2022094115448.h5
  |========================================================================================================================| 100%
Downloading: 4.1 kB     NULL

Error: object 'AllAngle_Composite_Snow_Free' not found

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.

GitHub Pages Error

In R when using pkgdown, and after running use_pkgdown_github_pages() we're getting the below error.

✔ Writing '_pkgdown.yml'
• Modify '_pkgdown.yml'
✔ Activating GitHub Pages for 'worldbank/blackmarbler'
Error in `gh_process_response()`:
! GitHub API error (404): Not Found
✖ URL not found: <https://api.github.com/repos/worldbank/blackmarbler/pages>
ℹ Read more at <https://docs.github.com/rest/pages/pages#create-a-apiname-pages-site>
Run `rlang::last_trace()` to see where the error occurred.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.