Skip to content

Commit 718dfb3

Browse files
authored
Merge pull request #11 from GeoRegionsEcosystem/v0.6
Changes to v0.6 because GeoRegions.jl is going to bump to v8
2 parents 12fd293 + 37b404a commit 718dfb3

File tree

10 files changed

+38
-40
lines changed

10 files changed

+38
-40
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "a018b980-0677-41c0-b9a4-7f34595c2b14"
33
keywords = ["meteorology", "climate", "precipitation", "nasa", "satellite"]
44
desc = "Download and analyze data from the NASA GPM/TRMM missions"
55
authors = ["Nathanael Wong <natgeo.wong@outlook.com>"]
6-
version = "0.5.1"
6+
version = "0.6.0"
77

88
[deps]
99
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
@@ -19,14 +19,14 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1919

2020
[compat]
2121
Dates = "1"
22-
GeoRegions = "7"
23-
LandSea = "0.0.2"
22+
GeoRegions = "^8.0.1"
23+
LandSea = "0.1"
2424
Logging = "1"
2525
NCDatasets = "0.14"
2626
NetRC = "0.1"
2727
Printf = "1"
2828
Reexport = "1"
29-
RegionGrids = "0.0.5"
29+
RegionGrids = "0.1"
3030
Statistics = "1"
3131
julia = "^1.10"
3232

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ for file in files
5454
end
5555

5656
deploydocs(
57-
repo = "github.com/natgeo-wong/NASAPrecipitation.jl.git",
57+
repo = "github.com/GeoRegionsEcosystem/NASAPrecipitation.jl.git",
5858
devbranch = "main"
5959
)

src/.georegions/GLB180.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ID":"GLB180","pID":"GLB","name":"Globe (180 Grid)","rotation":0.0,"geometry":{"level":1,"longitude":[-180.0,180.0,180.0,-180.0,-180.0],"latitude":[-90.0,-90.0,90.0,90.0,-90.0]}}

src/.georegions/TRMM.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ID":"TRMM","pID":"GLB","name":"TRMM Dataset","rotation":0.0,"geometry":{"level":1,"longitude":[-180.0,180.0,180.0,-180.0,-180.0],"latitude":[-50.0,-50.0,50.0,50.0,-50.0]}}

src/NASAPrecipitation.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
module NASAPrecipitation
22

3-
## Modules Used
3+
## Base Modules Used
44
using Logging
5-
using NetRC
65
using Printf
76
using Statistics
7+
8+
## Modules Used
9+
using LandSea
10+
using NetRC
811
using RegionGrids
912

1013
import Base: download, show, read
14+
import GeoRegions: in
1115
import RegionGrids: extract
1216
import LandSea: getLandSea
1317

1418
## Reexporting exported functions within these modules
1519
using Reexport
1620
@reexport using Dates
1721
@reexport using GeoRegions
18-
@reexport using LandSea
1922
@reexport using NCDatasets
2023

2124
## Exporting the following functions:
@@ -82,7 +85,7 @@ Abstract supertype for TRMM TMPA datasets on NASA OPeNDAP Servers, a subType of
8285
abstract type TRMMDataset <: NASAPrecipitationDataset end
8386

8487
modulelog() = "$(now()) - NASAPrecipitation.jl"
85-
npddir = joinpath(@__DIR__,"files")
88+
geopath = joinpath(@__DIR__,".georegions")
8689

8790
function __init__()
8891
setup()

src/downloads.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ function download(
2525
@info "$(modulelog()) - Downloading $(npd.name) data for the $(geo.name) GeoRegion from $(npd.start) to $(npd.stop)"
2626

2727
if geo.ID == "GLB"
28-
geo = GeoRegion("IMERG",path=npddir)
28+
geo = GeoRegion("GLB180",path=geopath)
2929
else
30-
in(geo,GeoRegion("IMERG",path=npddir))
30+
in(geo,GeoRegion("GLB180",path=geopath))
3131
end
3232

3333
dyfnc = imergrawfiles()
@@ -129,9 +129,9 @@ function download(
129129
@info "$(modulelog()) - Downloading $(npd.name) data for the $(geo.name) GeoRegion from $(npd.start) to $(npd.stop)"
130130

131131
if geo.ID == "GLB"
132-
geo = GeoRegion("IMERG",path=npddir)
132+
geo = GeoRegion("GLB180",path=geopath)
133133
else
134-
in(geo,GeoRegion("IMERG",path=npddir))
134+
in(geo,GeoRegion("GLB180",path=geopath))
135135
end
136136

137137
lon,lat = gpmlonlat(); nlon = length(lon)
@@ -222,9 +222,9 @@ function download(
222222
@info "$(modulelog()) - Downloading $(npd.name) data for the $(geo.name) GeoRegion from $(npd.start) to $(npd.stop)"
223223

224224
if geo.ID == "GLB"
225-
geo = GeoRegion("IMERG",path=npddir)
225+
geo = GeoRegion("GLB180",path=geopath)
226226
else
227-
in(geo,GeoRegion("IMERG",path=npddir))
227+
in(geo,GeoRegion("GLB180",path=geopath))
228228
end
229229

230230
lon,lat = gpmlonlat(); nlon = length(lon)
@@ -312,9 +312,9 @@ function download(
312312
@info "$(modulelog()) - Downloading $(npd.name) data for the $(geo.name) GeoRegion from $(npd.start) to $(npd.stop)"
313313

314314
if geo.ID == "GLB"
315-
geo = GeoRegion("IMERG",path=npddir)
315+
geo = GeoRegion("GLB180",path=geopath)
316316
else
317-
in(geo,GeoRegion("IMERG",path=npddir))
317+
in(geo,GeoRegion("GLB180",path=geopath))
318318
end
319319

320320
lon,lat = trmmlonlat(); nlon = length(lon)
@@ -406,9 +406,9 @@ function download(
406406
@info "$(modulelog()) - Downloading $(npd.name) data for the $(geo.name) GeoRegion from $(npd.start) to $(npd.stop)"
407407

408408
if geo.ID == "GLB"
409-
geo = GeoRegion("IMERG",path=npddir)
409+
geo = GeoRegion("GLB180",path=geopath)
410410
else
411-
in(geo,GeoRegion("IMERG",path=npddir))
411+
in(geo,GeoRegion("GLB180",path=geopath))
412412
end
413413

414414
lon,lat = trmmlonlat(); nlon = length(lon)
@@ -497,9 +497,9 @@ function download(
497497
@info "$(modulelog()) - Downloading $(npd.name) data for the $(geo.name) GeoRegion from $(npd.start) to $(npd.stop)"
498498

499499
if geo.ID == "GLB"
500-
geo = GeoRegion("IMERG",path=npddir)
500+
geo = GeoRegion("GLB180",path=geopath)
501501
else
502-
in(geo,GeoRegion("IMERG",path=npddir))
502+
in(geo,GeoRegion("GLB180",path=geopath))
503503
end
504504

505505
lon,lat = trmmlonlat(); nlon = length(lon)

src/files/rectlist.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/landsea/imerg.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
geo :: GeoRegion = GeoRegion("GLB");
55
returnlsd = true,
66
FT = Float32
7-
) -> LandSea
7+
) -> LandSea.LandSeaFlat
88
99
Retrieve the Land-Sea Mask data for the `NASAPrecipitationDataset` specified.
1010
@@ -15,7 +15,7 @@ Arguments
1515
1616
Keyword Arguments
1717
=================
18-
- `returnlsd` : If `true` return the data as a `LandSea` dataset. Otherwise, the data is simply saved into the npd.maskpath directory.
18+
- `returnlsd` : If `true` return the data as a `LandSea.LandSeaFlat` dataset. Otherwise, the data is simply saved into the npd.maskpath directory.
1919
"""
2020
function getLandSea(
2121
npd :: IMERGDataset,
@@ -24,11 +24,11 @@ function getLandSea(
2424
)
2525

2626
if geo.ID == "GLB"
27-
@info "$(modulelog()) - Global dataset request has been detected, switching to the IMERG LandSea Mask GeoRegion"
28-
geo = GeoRegion("IMERG",path=npddir)
27+
@info "$(modulelog()) - Global dataset request has been detected, switching to the Global (180 Grid) LandSea Mask GeoRegion"
28+
geo = GeoRegion("GLB180",path=geopath)
2929
else
3030
@info "$(modulelog()) - Checking to see if the specified GeoRegion \"$(geo.ID)\" is within the \"IMERG\" GeoRegion"
31-
in(geo,GeoRegion("IMERG",path=npddir),throw=true)
31+
in(geo,GeoRegion("GLB180",path=geopath),throw=true)
3232
end
3333

3434
lsmfnc = joinpath(npd.maskpath,"imergmask-$(geo.ID).nc")
@@ -37,9 +37,9 @@ function getLandSea(
3737

3838
@info "$(modulelog()) - The IMERG Land-Sea mask dataset for the \"$(geo.ID)\" GeoRegion is not available, extracting from Global IMERG Land-Sea mask dataset ..."
3939

40-
glbfnc = joinpath(npd.maskpath,"imergmask-IMERG.nc")
40+
glbfnc = joinpath(npd.maskpath,"imergmask-GLB180.nc")
4141
if !isfile(glbfnc)
42-
@info "$(modulelog()) - The Global IMERG Land-Sea mask dataset for the \"$(geo.ID)\" GeoRegion is not available, downloading from the NASA OPeNDAP servers ..."
42+
@info "$(modulelog()) - The Global (180 Grid) IMERG Land-Sea mask dataset for the \"$(geo.ID)\" GeoRegion is not available, downloading from the NASA OPeNDAP servers ..."
4343
downloadLandSea(npd)
4444
end
4545

@@ -52,7 +52,7 @@ function getLandSea(
5252
ggrd = RegionGrid(geo,glon,glat)
5353
mask = ggrd.mask; mask[isnan.(mask)] .= 0
5454

55-
@info "$(modulelog()) - Extracting regional IMERG Land-Sea mask for the \"$(geo.ID)\" GeoRegion from the Global IMERG Land-Sea mask dataset ..."
55+
@info "$(modulelog()) - Extracting regional IMERG Land-Sea mask for the \"$(geo.ID)\" GeoRegion from the Global (180 Grid) IMERG Land-Sea mask dataset ..."
5656

5757
rlsm = extract(glsm,ggrd)
5858

@@ -101,7 +101,7 @@ function downloadLandSea(
101101
var[ilat,ilon] = 1 - var[ilat,ilon] / 100
102102
end
103103

104-
saveLandSea(npd,GeoRegion("IMERG",path=npddir),lon,lat,var',mask)
104+
saveLandSea(npd,GeoRegion("GLB180",path=geopath),lon,lat,var',mask)
105105

106106
end
107107

src/landsea/trmm.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ function getLandSea(
66

77
if geo.ID == "GLB"
88
@info "$(modulelog()) - Global dataset request has been detected, switching to the TRMM LandSea Mask GeoRegion"
9-
geo = GeoRegion("TRMMLSM",path=npddir)
9+
geo = GeoRegion("TRMMLSM",path=geopath)
1010
else
1111
@info "$(modulelog()) - Checking to see if the specified GeoRegion \"$(geo.ID)\" is within the \"TRMMLSM\" GeoRegion"
12-
in(geo,GeoRegion("TRMMLSM",path=npddir),throw=true)
12+
in(geo,GeoRegion("TRMMLSM",path=geopath),throw=true)
1313
end
1414

1515
lsmfnc = joinpath(npd.maskpath,"trmmmask-$(geo.ID).nc")

src/save.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function save(
5959
dt :: TimeType,
6060
npd :: NASAPrecipitationDataset,
6161
geo :: GeoRegion,
62-
lsd :: LandSeaData;
62+
lsd :: LandSeaFlat;
6363
smooth :: Bool = false,
6464
smoothlon :: Real = 0,
6565
smoothlat :: Real = 0,

0 commit comments

Comments
 (0)