Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Jul 23, 2023
1 parent 3ba98c2 commit efb0e36
Show file tree
Hide file tree
Showing 14 changed files with 168 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
# - windows-latest
arch:
- x64
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Documenter
on:
push:
branches: [master]
branches: [master, main]
tags: [v*]
pull_request:

branches: [master, main]
jobs:
Documenter:
name: Documentation
Expand All @@ -14,5 +14,7 @@ jobs:
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
RASTERDATASOURCES_PATH: ".."
GKSwstype: "100"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
110 changes: 0 additions & 110 deletions doc/cal_anomaly.qmd

This file was deleted.

2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
29 changes: 29 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Documenter, Ipaper

CI = get(ENV, "CI", nothing) == "true"

# Logging.disable_logging(Logging.Warn)

# Make the docs, without running the tests again
# We need to explicitly add all the extensions here
makedocs(
modules=[
Ipaper
],
format=Documenter.HTML(
prettyurls=CI,
),
pages=[
"Introduction" => "index.md"
],
sitename="Ipaper.jl",
strict=false,
clean=false,
)

# Enable logging to console again
# Logging.disable_logging(Logging.BelowMinLevel)

deploydocs(
repo="github.com/jl-spatial/Ipaper.jl.git",
)
94 changes: 94 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
## Thresholds

```@docs
cal_anomaly_quantile
cal_anomaly_clim
cal_threshold
```

```@docs
_cal_anomaly_3d
```

```@docs
cal_mTRS_base
cal_mTRS_full
cal_climatology_base
cal_climatology_full
```


```@docs
cal_mTRS_base!
cal_mTRS_base3!
NanQuantile_low
```


```@docs
cal_yearly_Tair
cal_warming_level
```

## Quantile

```@docs
NanQuantile_3d!
movmean
linreg_simple
linreg_fast
```


## Statistics

```@docs
apply
```

## Strings

```@docs
str_extract
str_extract_all
str_replace
grepl
```

## Plots

```@docs
merge_pdf
show_pdf
```

## cmd

```@docs
dir
path_mnt
writelines
```

## R base

```@docs
duplicated
list
match2
```

### Missing

```@docs
drop_missing
to_missing
```

## Parallel

```@docs
isCurrentWorker
```
32 changes: 14 additions & 18 deletions src/Climate/anomaly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ Calculate the anomaly of a 3D array of temperature data.
- `A` : the 3D array of temperature data
- `dates` : an array of dates corresponding to the temperature data
- `parallel` : whether to use parallel processing (default `false`)
- `use_mov` : whether to use a moving window to calculate the threshold (default `true`)
- `method` : the method to use for calculating the threshold, one of `["full", "season", "base"]` (default `"full"`)
- `parallel` : whether to use parallel processing (default `true`)
- `use_mov` : whether to use a moving window to calculate the threshold
(default `true`)
- `method` : the method to use for calculating the threshold, one of `["full",
"season", "base"]` (default `"full"`)
- `probs` : default `[0.5]`
- `p1` : the start year for the reference period (default `1981`)
- `p2` : the end year for the reference period (default `2010`)
Expand All @@ -76,14 +78,14 @@ An array of the same shape as `A` containing the temperature anomaly.
# References
1. Vogel, M. M., Zscheischler, J., Fischer, E. M., & Seneviratne, S. I. (2020).
Development of Future Heatwaves for Different Hazard Thresholds. Journal of
Geophysical Research: Atmospheres, 125(9).
https://doi.org/10.1029/2019JD032070
Development of Future Heatwaves for Different Hazard Thresholds. Journal of
Geophysical Research: Atmospheres, 125(9).
<https://doi.org/10.1029/2019JD032070>
"""
function cal_anomaly_quantile(
A::AbstractArray{T}, dates;
parallel::Bool=false,
parallel::Bool=true,
use_mov=true, na_rm=true,
method="full",
p1=1981, p2=2010,
Expand All @@ -109,14 +111,16 @@ end


"""
$(TYPEDSIGNATURES)
Calculate the anomaly of an array relative to its climatology.
# Arguments
- `A::AbstractArray{T}`: The input array to calculate the anomaly of.
- `dates`: The dates corresponding to the input array.
- `parallel::Bool=false`: Whether to use parallel processing.
- `parallel::Bool=true`: Whether to use parallel processing.
- `use_mov=true`: Whether to use a moving window to calculate the climatology.
- `method="full"`: The method to use for calculating the climatology. Can be "base", "season", or "full".
- `p1=1981`: The start year for the period to use for calculating the climatology.
Expand All @@ -142,7 +146,7 @@ anom = cal_anomaly_clim(A, dates; method="base")
function cal_anomaly_clim(
A::AbstractArray{T},
dates;
parallel::Bool=false,
parallel::Bool=true,
use_mov=true,
method="full",
p1=1981, p2=2010,
Expand All @@ -168,15 +172,7 @@ end


"""
cal_threshold(
A::AbstractArray{T}, dates;
parallel::Bool=false,
use_mov=true, na_rm=true,
method="full",
p1=1981, p2=2010,
probs::Vector=[0.90, 0.95, 0.99, 0.999, 0.9999],
options...
)
$(TYPEDSIGNATURES)
Calculate the threshold value for a given dataset `A` and dates. The threshold value is calculated based on the specified method.
Expand Down
Loading

0 comments on commit efb0e36

Please sign in to comment.