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

change end date #46

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/readnl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ start_date = Date(2015, 01)
end_date = Date(2020, 12)
rad_dc, cf_dc = readnl(xlims, ylims, start_date, end_date)
"""
function readnl(xlims = X(Rasters.Between(65.39, 99.94)), ylims = Y(Rasters.Between(5.34, 39.27)), start_date = Date(2012, 04), end_date = Date(2023, 01))
function readnl(xlims = X(Rasters.Between(65.39, 99.94)), ylims = Y(Rasters.Between(5.34, 39.27)), start_date = Date(2012, 04), end_date = Date(today()))
lims = xlims, ylims
rad_path = "/mnt/giant-disk/nighttimelights/monthly/rad/"
rad_files, sorted_dates = sort_files_by_date(rad_path, start_date, end_date)
Expand All @@ -48,8 +48,9 @@ function readnl(xlims = X(Rasters.Between(65.39, 99.94)), ylims = Y(Rasters.Betw
cf_raster_list = [Raster(i, lazy = true)[lims...] for i in cf_path .* cf_files]
rad_series = RasterSeries(rad_raster_list, Ti(sorted_dates))
cf_series = RasterSeries(cf_raster_list, Ti(sorted_dates))
rad_datacube = Rasters.combine(rad_series, Ti)
cf_datacube = Rasters.combine(cf_series, Ti)
rad_datacube = Float16.(Rasters.combine(rad_series, Ti))
cf_datacube = Int8.(Rasters.combine(cf_series, Ti))
replace!(rad_datacube, Inf => prevfloat(typemax(rad_datacube[1,1,1])))
return rad_datacube, cf_datacube
end

Expand All @@ -75,7 +76,7 @@ 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))
function readnl(geom, start_date = Date(2012, 04), end_date = today())
rad_path = "/mnt/giant-disk/nighttimelights/monthly/rad/"
rad_files, sorted_dates = sort_files_by_date(rad_path, start_date, end_date)
cf_path = "/mnt/giant-disk/nighttimelights/monthly/cf/"
Expand All @@ -84,7 +85,8 @@ function readnl(geom, start_date = Date(2012, 04), end_date = Date(2023, 01))
cf_raster_list = [crop(Raster(i, lazy = true), to = geom) for i in cf_path .* cf_files]
rad_series = RasterSeries(rad_raster_list, Ti(sorted_dates))
cf_series = RasterSeries(cf_raster_list, Ti(sorted_dates))
rad_datacube = Rasters.combine(rad_series, Ti)
cf_datacube = Rasters.combine(cf_series, Ti)
rad_datacube = Float16.(Rasters.combine(rad_series, Ti))
cf_datacube = Int8.(Rasters.combine(cf_series, Ti))
replace!(rad_datacube, Inf => prevfloat(typemax(rad_datacube[1,1,1])))
return rad_datacube, cf_datacube
end
Loading