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

Refactor of Codebase #12

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open

Conversation

dar4datascience
Copy link

Change in Packages

Migration of
- raster to terra addresses #8 issue
- httr to httr2

Main Functions

The functions written under each main function are as follows

  • bm_raster:
    • define_blackmarble_variable
    • define_raster_name
    • retrieve_and_process_nightlight_data (main function):
      • create_black_marble_dataset_df
      • intersect_bm_tiles
      • process_tiles:
        • download_and_convert_raster:
  • bm_extract:
    • bm_raster
    • extract_and_process
    • define_raster_name (when saving file locally)

Extra Functions

  • map_black_marble_tiles

Mermaid

Structure of Functions

graph TD;

  

bm_raster-->define_blackmarble_variable;

bm_raster-->define_raster_name;

bm_raster-->retrieve_and_process_nightlight_data;

  

retrieve_and_process_nightlight_data-->create_black_marble_dataset_df;

retrieve_and_process_nightlight_data-->intersect_bm_tiles;

retrieve_and_process_nightlight_data-->process_tiles;

  

process_tiles-->download_and_convert_raster;

download_and_convert_raster-->download_h5_viirs_sat_image;

download_and_convert_raster-->convert_h5_to_raster;

  

convert_h5_to_raster-->extract_data_and_metadata_from_hdf5;

extract_data_and_metadata_from_hdf5-->extract_daily_data;

extract_data_and_metadata_from_hdf5-->extract_monthly_data;

convert_h5_to_raster-->create_raster_from_data_metadata;

convert_h5_to_raster-->clean_raster_data;

  

bm_extract-->bm_raster;

bm_extract-->extract_and_process;

bm_extract-->define_raster_name;
Loading

Tests Added

  • test-bm_extract-diffvars.R: tests others variables from the VNP43A* products
  • test-bm_extract-outputlocation.R: test files are saved locally
  • test-bm_extract-stack.R: tests passing sequence of days works
  • test-bm_extract.R: test bm_extract function returns a dataframe
  • test-bm_raster-simple.R: test bm_raster returns a raster
  • test-bm_raster-stack.R: tests passing a sequence of days works
  • test-bm_utils.R: not full coverage

Tests made in R version 4.4.0

Ran locally.

image

Documentation Migration

Implemented in docs folder code for using quarto as documentation in github pages.
Example available in here

Detail Folder Structure of Project

blackmarbler
├── blackmarbler.Rproj
├── data
│ └── black_marble_tiles_sf.rda
├── DESCRIPTION
├── docs
│ ├── about.qmd
│ ├── assess-quality.Rmd
│ ├── benchmark_reading_laads_remote_csv.qmd
│ ├── docs.Rproj
│ ├── _extensions
│ │ └── coatless
│ │ └── webr
│ │ ├── _extension.yml
│ │ ├── qwebr-cell-elements.js
│ │ ├── qwebr-cell-initialization.js
│ │ ├── qwebr-compute-engine.js
│ │ ├── qwebr-document-engine-initialization.js
│ │ ├── qwebr-document-settings.js
│ │ ├── qwebr-document-status.js
│ │ ├── qwebr-monaco-editor-element.js
│ │ ├── qwebr-monaco-editor-init.html
│ │ ├── qwebr-styling.css
│ │ ├── qwebr-theme-switch.js
│ │ ├── template.qmd
│ │ ├── webr.lua
│ │ ├── webr-serviceworker.js
│ │ └── webr-worker.js
│ ├── images
│ │ ├── favicon.ico
│ │ ├── logo.png
│ │ ├── nasa_laads_login.png
│ │ ├── ntl_gha.png
│ │ └── ntl_trends_gha.png
│ ├── index.qmd
│ ├── _quarto.yml
│ ├── _site
│ │ ├── about.html
│ │ ├── assess-quality.html
│ │ ├── benchmark_reading_laads_remote_csv.html
│ │ ├── images
│ │ │ ├── favicon.ico
│ │ │ ├── logo.png
│ │ │ ├── nasa_laads_login.png
│ │ │ ├── ntl_gha.png
│ │ │ └── ntl_trends_gha.png
│ │ ├── index.html
│ │ ├── robots.txt
│ │ ├── search.json
│ │ ├── site_libs
│ │ │ ├── bootstrap
│ │ │ │ ├── bootstrap-icons.css
│ │ │ │ ├── bootstrap-icons.woff
│ │ │ │ ├── bootstrap.min.css
│ │ │ │ └── bootstrap.min.js
│ │ │ ├── clipboard
│ │ │ │ └── clipboard.min.js
│ │ │ ├── quarto-html
│ │ │ │ ├── anchor.min.js
│ │ │ │ ├── popper.min.js
│ │ │ │ ├── quarto.js
│ │ │ │ ├── quarto-syntax-highlighting-dark.css
│ │ │ │ ├── tippy.css
│ │ │ │ ├── tippy.umd.min.js
│ │ │ │ └── zenscroll-min.js
│ │ │ ├── quarto-nav
│ │ │ │ ├── headroom.min.js
│ │ │ │ └── quarto-nav.js
│ │ │ └── quarto-search
│ │ │ ├── autocomplete.umd.js
│ │ │ ├── fuse.min.js
│ │ │ └── quarto-search.js
│ │ ├── sitemap.xml
│ │ ├── styles.css
│ │ ├── testing_webr.html
│ │ ├── webr-serviceworker.js
│ │ └── webr-worker.js
│ ├── styles.css
│ └── testing_webr.qmd
├── LICENSE
├── man
│ ├── add_n_pixels.Rd
│ ├── apply_scaling_factor_to_viirs_data.Rd
│ ├── bind_extracted_data.Rd
│ ├── black_marble_tiles_sf.Rd
│ ├── bm_extract.Rd
│ ├── bm_raster.Rd
│ ├── clean_raster_data.Rd
│ ├── convert_h5_to_raster.Rd
│ ├── count_n_obs.Rd
│ ├── create_black_marble_dataset_df.Rd
│ ├── create_raster_from_data_metadata.Rd
│ ├── custom_inform.Rd
│ ├── define_blackmarble_variable.Rd
│ ├── define_raster_name.Rd
│ ├── download_and_convert_raster.Rd
│ ├── download_h5_viirs_sat_image.Rd
│ ├── extract_and_process.Rd
│ ├── extract_bounding_box.Rd
│ ├── extract_daily_data.Rd
│ ├── extract_data_and_metadata_from_hdf5.Rd
│ ├── extract_monthly_data.Rd
│ ├── figures
│ │ ├── logo.png
│ │ ├── nasa_laads_login.png
│ │ ├── ntl_gha.png
│ │ └── ntl_trends_gha.png
│ ├── intersect_bm_tiles.Rd
│ ├── julian_to_month.Rd
│ ├── map_black_marble_tiles.Rd
│ ├── process_tiles.Rd
│ ├── read_black_marble_csv.Rd
│ ├── remove_fill_value_from_satellite_data.Rd
│ └── retrieve_and_process_nightlight_data.Rd
├── NAMESPACE
├── pkgdown
│ └── favicon
│ ├── apple-touch-icon-120x120.png
│ ├── apple-touch-icon-152x152.png
│ ├── apple-touch-icon-180x180.png
│ ├── apple-touch-icon-60x60.png
│ ├── apple-touch-icon-76x76.png
│ ├── apple-touch-icon.png
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ └── favicon.ico
├── _pkgdown.yml
├── R
│ ├── blackmarbler.R
│ ├── blackmarble_utils.R
│ ├── data.R
│ └── sysdata.rda
├── readme_figures
│ ├── build_package.R
│ ├── export_geojson_2_package_data.R
│ ├── figures_for_readme.R
│ ├── make_hex.R
│ └── readme_test.R
├── README.md
├── renv
│ ├── activate.R
│ ├── settings.json
│ └── staging
├── renv.lock
└── tests
├── testthat
│ ├── test-bm_extract-diffvars.R
│ ├── test-bm_extract-outputlocation.R
│ ├── test-bm_extract.R
│ ├── test-bm_extract-stack.R
│ ├── test-bm_raster-simple.R
│ ├── test-bm_raster-stack.R
│ └── test-bm_utils.R
└── testthat.R

dar4ds added 30 commits March 20, 2024 21:50
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

Successfully merging this pull request may close these issues.

1 participant