Skip to content

Commit 00f1b73

Browse files
authored
Merge pull request #502 from JuliaDataCubes/engineyax
Add DiskArrayEngine-based xmap function
2 parents 1069fa1 + 2b8f49f commit 00f1b73

File tree

19 files changed

+1031
-192
lines changed

19 files changed

+1031
-192
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CFTime = "179af706-886a-5703-950a-314cd64e0468"
88
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
99
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
1010
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
11+
DiskArrayEngine = "2d4b2e14-ccd6-4284-b8b0-2378ace7c126"
1112
DiskArrayTools = "fcd2136c-9f69-4db6-97e5-f31981721d63"
1213
DiskArrays = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3"
1314
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ OnlineStats = "a15396b6-48d5-5d58-9928-6d29437db91e"
2626
PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043"
2727
SkipNan = "aed68c70-c8b0-4309-8cd1-d392a74f991a"
2828
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
29+
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
2930
TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e"
3031
WeightedOnlineStats = "bbac0a1f-7c9d-5672-960b-c6ca726e5d5d"
3132
YAXArrayBase = "90b8fcef-0c2d-428d-9c56-5f86629e9d14"

docs/src/UserGuide/compute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Reduce the time dimension by calculating the average value of all points in time
8484

8585
````@example compute
8686
import Statistics: mean
87-
mapslices(mean, a, dims="Time")
87+
mapslices(mean, a, dims="time")
8888
````
8989
There is no time dimension left, because there is only one value left after averaging all time steps.
9090
We can also calculate spatial means resulting in one value per time step:

docs/src/UserGuide/group.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,39 @@ sum_days = sum.(g_tempo, dims=:time)
126126

127127
Weight the seasonal groups by `sum_days`
128128

129-
````@ansi compareXarray
129+
::: danger WIP
130+
131+
DiskArrayEngine fails from here on...
132+
133+
:::
134+
135+
````julia compareXarray
130136
weights = map(./, g_tempo, sum_days)
131137
````
132138

133139
Verify that the sum per season is 1
134140

135-
````@ansi compareXarray
141+
````julia compareXarray
136142
sum.(weights)
137143
````
138144
### weighted seasons
139145

140146
Now, let's weight the seasons
141147

142-
````@ansi compareXarray
148+
````julia compareXarray
143149
g_dsW = broadcast_dims.(*, weights, g_ds)
144150
````
145151

146152
apply a `sum` over the time dimension and drop it
147153

148-
````@ansi compareXarray
154+
````julia compareXarray
149155
weighted_g = sum.(g_dsW, dims = :time);
150156
weighted_g = dropdims.(weighted_g, dims=:time)
151157
````
152158

153159
Calculate the differences
154160

155-
````@ansi compareXarray
161+
````julia compareXarray
156162
diff_g = map(.-, weighted_g, mean_g)
157163
````
158164

@@ -164,7 +170,7 @@ mean_g, weighted_g, diff_g, seasons_g = weighted_seasons(ds)
164170

165171
Once all calculations are done we can plot the results with `Makie.jl` as follows:
166172

167-
````@example compareXarray
173+
````julia compareXarray
168174
using CairoMakie
169175
# define plot arguments/attributes
170176
colorrange = (-30,30)
@@ -174,7 +180,7 @@ lowclip = :grey15
174180
cb_label = ds_o.properties["long_name"]
175181
````
176182

177-
````@example compareXarray
183+
````julia compareXarray
178184
with_theme(theme_ggplot2()) do
179185
hm_o, hm_d, hm_w = nothing, nothing, nothing
180186
# the figure

docs/src/UserGuide/read.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ ds = open_mfdataset(DD.DimArray(files, YAX.time()))
180180

181181
where the contents of the `time` dimension are the merged values from both files
182182

183-
````@ansi open_list_netcdf
183+
````@example open_list_netcdf
184184
ds["time"]
185185
````
186186

0 commit comments

Comments
 (0)