Skip to content

Commit

Permalink
Merge pull request #111 from ayushpatnaikgit/main
Browse files Browse the repository at this point in the history
Update package and Julia version. Export readnl
  • Loading branch information
ayushpatnaikgit authored Jun 26, 2024
2 parents 6ab0b35 + de319d2 commit 047b70e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jobs:
- name: Run tests
run: julia --project=. -e 'using Pkg; Pkg.test("NighttimeLights", coverage=true)'
- name: Codecov
run: julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV }}
run: julia --project=. -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ CSV = "0.10.4"
CubicSplines = "0.1.1, 0.2"
DataFrames = "1.3.3"
Dates = "1.7.0"
DimensionalData = "0.21"
DimensionalData = "0.27.3"
Distributions = "0.25.53"
GLM = "1.7.0"
HypothesisTests = "0.10.9, 0.11"
Images = "0.25.2"
Plots = "1"
Rasters = "0.5"
Shapefile = "0.7.4, 0.8, 0.10, 0.12"
Rasters = "0.11"
Shapefile = "0.10, 0.12"
SmoothingSplines = "0.3.1"
Statistics = "1.7.0"
StatsBase = "0.33.16, 0.34"
julia = "1"
julia = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
2 changes: 1 addition & 1 deletion src/NighttimeLights.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module NighttimeLights
using Rasters, DataFrames, Shapefile, StatsBase, SmoothingSplines, GLM, Distributions, HypothesisTests, Plots, Dates, DimensionalData, CubicSplines, SparseArrays, NCDatasets, ArchGDAL

## Utilities
export Raster, load_example, radiance_datacube, ncfobs_datacube, long_apply, apply_mask, mumbai_map, add_dim, annular_ring, centre_of_mass
export Raster, load_example, radiance_datacube, ncfobs_datacube, long_apply, apply_mask, mumbai_map, add_dim, annular_ring, centre_of_mass, readnl

## cleaning methods
export bgnoise_PSTT2021, bias_PSTT2021, PSTT2021_conventional, PSTT2021, clean_complete, na_interp_linear, na_recode, outlier_variance, outlier_hampel, replace_negative
Expand Down
6 changes: 3 additions & 3 deletions src/readnl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ Two `RasterDataCube` instances. The first contains the cropped radiance data, an
# Examples
```julia
using Geometries
geom = Geometries.read("path_to_your_shapefile.shp") # replace this with your actual shapefile
using Shapefile
geom = Shapefile.Table("path_to_your_shapefile.shp").geometry[1] # replace this with your actual shapefile
start_date = Date(2015, 01)
end_date = Date(2020, 12)
rad_dc, cf_dc = readnl(geom, start_date, end_date)
```
"""
function readnl(geom, start_date = Date(2012, 04), end_date = Date(2023, 01); rad_path = "/mnt/giant-disk/nighttimelights/monthly/rad/", cf_path = "/mnt/giant-disk/nighttimelights/monthly/cf/")
function readnl(geom::Shapefile.Polygon, start_date = Date(2012, 04), end_date = Date(2023, 01); rad_path = "/mnt/giant-disk/nighttimelights/monthly/rad/", cf_path = "/mnt/giant-disk/nighttimelights/monthly/cf/")
rad_files, sorted_dates = sort_files_by_date(rad_path, start_date, end_date)
cf_files, sorted_dates = sort_files_by_date(cf_path, start_date, end_date)
rad_raster_list = [crop(Raster(i, lazy = true), to = geom) for i in rad_path .* rad_files]
Expand Down

0 comments on commit 047b70e

Please sign in to comment.