Skip to content

Commit 698626f

Browse files
committed
broken sections
1 parent 99bf9ca commit 698626f

File tree

5 files changed

+39
-26
lines changed

5 files changed

+39
-26
lines changed

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: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ savecube(a4, "a4.nc")
139139

140140
### along a new dimension
141141

142-
````@example open_list_netcdf
142+
::: danger
143+
144+
broken!
145+
146+
:::
147+
148+
````julia open_list_netcdf
143149
using YAXArrays, NetCDF, Dates
144150
using YAXArrays: YAXArrays as YAX
145151
import DimensionalData as DD
@@ -152,14 +158,14 @@ ds = open_mfdataset(DD.DimArray(files, YAX.time(dates_read)))
152158

153159
and even opening files along a new `Time` dimension that already have a `time` dimension
154160

155-
````@example open_list_netcdf
161+
````julia open_list_netcdf
156162
files = ["a3.nc", "a4.nc"]
157163
ds = open_mfdataset(DD.DimArray(files, YAX.Time(dates_read)))
158164
````
159165

160166
Note that opening along a new dimension name without specifying values also works; however, it defaults to `1:length(files)` for the dimension values.
161167

162-
````@example open_list_netcdf
168+
````julia open_list_netcdf
163169
files = ["a1.nc", "a2.nc"]
164170
ds = open_mfdataset(DD.DimArray(files, YAX.time))
165171
````
@@ -168,7 +174,7 @@ ds = open_mfdataset(DD.DimArray(files, YAX.time))
168174

169175
Another use case is when we want to open files along an existing dimension. In this case, `open_mfdataset` will concatenate the paths along the specified dimension
170176

171-
````@example open_list_netcdf
177+
````julia open_list_netcdf
172178
using YAXArrays, NetCDF, Dates
173179
using YAXArrays: YAXArrays as YAX
174180
import DimensionalData as DD
@@ -180,7 +186,7 @@ ds = open_mfdataset(DD.DimArray(files, YAX.time()))
180186

181187
where the contents of the `time` dimension are the merged values from both files
182188

183-
````@ansi open_list_netcdf
189+
````julia open_list_netcdf
184190
ds["time"]
185191
````
186192

docs/src/UserGuide/xcompute.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Reduce the time dimension by calculating the average value of all points in time
8686

8787
````@example compute
8888
import Statistics: mean
89-
mapslices(mean, a, dims="Time")
89+
mapslices(mean, a, dims="time")
9090
````
9191
There is no time dimension left, because there is only one value left after averaging all time steps.
9292
We can also calculate spatial means resulting in one value per time step:
@@ -143,7 +143,7 @@ Since `xmap` is operating in a lazy fashion, it can be directly used for follow-
143143
want to store the result to disk one can explicitly compute the result:
144144

145145
````@ansi mapCube
146-
gen_cube = compute_to_zarr(expanded_cube, "my_gen_cube.zarr", overwrite=true, max_cache=1e9)
146+
gen_cube = compute_to_zarr(Dataset(layer=r), "my_gen_cube.zarr", overwrite=true, max_cache=1e9)
147147
````
148148

149149
::: info "time axis goes first"
@@ -199,10 +199,8 @@ end
199199
f1(xin) = xin + 1
200200
f2(xin) = xin + 2
201201
````
202-
now, we define `InDims` and `OutDims`:
203202

204203
````@example outdims
205-
indims_one = InDims("Time")
206204
# outputs dimension
207205
properties_one = Dict{String, Any}("name" => "plus_one")
208206
properties_two = Dict{String, Any}("name" => "plus_two")
@@ -213,16 +211,14 @@ output_flat = XOutput(;)
213211
````
214212

215213
````@example outdims
216-
ds = mapCube(one_to_many, yax_test,
217-
indims = indims_one,
218-
outdims = (outdims_one, outdims_two, outdims_flat));
214+
ds = xmap(one_to_many, yax_test⊘:time, output = (output_one, output_two, output_flat));
219215
nothing # hide
220216
````
221217

222218
let's see the second output
223219

224220
````@example outdims
225-
ds[2]
221+
ds[2][:,1,1,1].data
226222
````
227223

228224
#### Many InDims to many OutDims
@@ -251,12 +247,17 @@ f2mix(xin_xyt, xin_xy) = xin_xyt - xin_xy
251247
````@example outdims
252248
output_time = XOutput(yax_test.time)
253249
output_flat = XOutput()
254-
output = (output_time,output_time,output_flat)
255250
````
256251

257252
````@example outdims
258-
ds = xmap(many_to_many, yax_test⊘:time, yax_2d, yax_test⊘:time,output = output);
259-
compute_to_zarr(Dataset(many_to_many_two=ds[2]),"test_mm.zarr",overwrite=true)
253+
r1, r2, r3 = xmap(many_to_many, yax_test⊘:time, yax_2d, yax_test⊘:time,
254+
output = (output_time, output_time, output_flat), inplace=true);
255+
nothing # hide
256+
````
257+
258+
````@example outdims
259+
dsout = Dataset(many_to_many_two=r2)
260+
compute_to_zarr(dsout, "test_mm.zarr", overwrite=true)
260261
nothing # hide
261262
````
262263

docs/src/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ end
1010
```
1111

1212
```@autodocs
13-
Modules = [YAXArrays, YAXArrays.Cubes, YAXArrays.DAT, YAXArrays.Datasets,YAXArrays.YAXTools]
13+
Modules = [YAXArrays, YAXArrays.Cubes, YAXArrays.DAT, YAXArrays.Datasets, YAXArrays.YAXTools, YAXArrays.Xmap]
1414
Private = false
1515
```
1616

1717
## Internal API
1818
```@autodocs
19-
Modules = [YAXArrays, YAXArrays.Cubes, YAXArrays.DAT,YAXArrays.Datasets,YAXArrays.YAXTools]
19+
Modules = [YAXArrays, YAXArrays.Cubes, YAXArrays.DAT, YAXArrays.Datasets, YAXArrays.YAXTools, YAXArrays.Xmap]
2020
Public = false
2121
```

0 commit comments

Comments
 (0)