tUse repeat syntax compatible across Julia 0.6 and 0.7 - Granular.jl - Julia pa… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c32a7776b1a9943cb5730470d85668419f29695b | |
parent e22516d887154d8292a6f810e41a33c598cfee5f | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 6 Jun 2018 14:03:35 -0400 | |
Use repeat syntax compatible across Julia 0.6 and 0.7 | |
Diffstat: | |
M src/atmosphere.jl | 46 ++++++++---------------------… | |
M src/ocean.jl | 48 +++++++++--------------------… | |
2 files changed, 26 insertions(+), 68 deletions(-) | |
--- | |
diff --git a/src/atmosphere.jl b/src/atmosphere.jl | |
t@@ -81,42 +81,20 @@ function createRegularAtmosphereGrid(n::Vector{Int}, | |
bc_east::Integer = 1, | |
bc_north::Integer = 1) | |
- if VERSION < v"0.7.0-DEV" | |
- xq = repmat(Compat.range(origo[1], stop=origo[1] + L[1], | |
- length=n[1] + 1), | |
- 1, n[2] + 1) | |
- yq = repmat(Compat.range(origo[2], stop=origo[2] + L[2], | |
- length=n[2] + 1)', | |
- n[1] + 1, 1) | |
- else | |
- xq = Compat.repeat(Compat.range(origo[1], stop=origo[1] + L[1], | |
- length=n[1] + 1), | |
- 1, n[2] + 1) | |
- yq = Compat.repeat(Compat.range(origo[2], stop=origo[2] + L[2], | |
- length=n[2] + 1)', | |
- n[1] + 1, 1) | |
- end | |
+ xq = repeat(Compat.range(origo[1], stop=origo[1] + L[1], length=n[1] + 1), | |
+ outer=[1, n[2] + 1]) | |
+ yq = repeat(Compat.range(origo[2], stop=origo[2] + L[2], length=n[2] + 1)', | |
+ outer=[n[1] + 1, 1]) | |
dx = L./n | |
- if VERSION < v"0.7.0-DEV" | |
- xh = repmat(Compat.range(origo[1] + .5*dx[1], | |
- stop=origo[1] + L[1] - .5*dx[1], | |
- length=n[1]), | |
- 1, n[2]) | |
- yh = repmat(Compat.range(origo[2] + .5*dx[2], | |
- stop=origo[1] + L[2] - .5*dx[2], | |
- length=n[2])', | |
- n[1], 1) | |
- else | |
- xh = Compat.repeat(Compat.range(origo[1] + .5*dx[1], | |
- stop=origo[1] + L[1] - .5*dx[1], | |
- length=n[1]), | |
- 1, n[2]) | |
- yh = Compat.repeat(Compat.range(origo[2] + .5*dx[2], | |
- stop=origo[1] + L[2] - .5*dx[2], | |
- length=n[2])', | |
- n[1], 1) | |
- end | |
+ xh = repeat(Compat.range(origo[1] + .5*dx[1], | |
+ stop=origo[1] + L[1] - .5*dx[1], | |
+ length=n[1]), | |
+ outer=[1, n[2]]) | |
+ yh = repeat(Compat.range(origo[2] + .5*dx[2], | |
+ stop=origo[1] + L[2] - .5*dx[2], | |
+ length=n[2])', | |
+ outer=[n[1], 1]) | |
zl = -Compat.range(.5*dx[3], stop=L[3] - .5*dx[3], length=n[3]) | |
diff --git a/src/ocean.jl b/src/ocean.jl | |
t@@ -293,42 +293,22 @@ function createRegularOceanGrid(n::Vector{Int}, | |
bc_east::Integer = 1, | |
bc_north::Integer = 1) | |
- if VERSION < v"0.7.0-DEV" | |
- xq = repmat(Compat.range(origo[1], stop=origo[1] + L[1], | |
- length=n[1] + 1), | |
- 1, n[2] + 1) | |
- yq = repmat(Compat.range(origo[2], stop=origo[2] + L[2], | |
- length=n[2] + 1)', | |
- n[1] + 1, 1) | |
- else | |
- xq = Compat.repeat(Compat.range(origo[1], stop=origo[1] + L[1], | |
- length=n[1] + 1), | |
- 1, n[2] + 1) | |
- yq = Compat.repeat(Compat.range(origo[2], stop=origo[2] + L[2], | |
- length=n[2] + 1)', | |
- n[1] + 1, 1) | |
- end | |
+ xq = repeat(Compat.range(origo[1], stop=origo[1] + L[1], | |
+ length=n[1] + 1), | |
+ outer=[1, n[2] + 1]) | |
+ yq = repeat(Compat.range(origo[2], stop=origo[2] + L[2], | |
+ length=n[2] + 1)', | |
+ outer=[n[1] + 1, 1]) | |
dx = L./n | |
- if VERSION < v"0.7.0-DEV" | |
- xh = repmat(Compat.range(origo[1] + .5*dx[1], | |
- stop=origo[1] + L[1] - .5*dx[1], | |
- length=n[1]), | |
- 1, n[2]) | |
- yh = repmat(Compat.range(origo[2] + .5*dx[2], | |
- stop=origo[2] + L[2] - .5*dx[2], | |
- length=n[2])', | |
- n[1], 1) | |
- else | |
- xh = Compat.repeat(Compat.range(origo[1] + .5*dx[1], | |
- stop=origo[1] + L[1] - .5*dx[1], | |
- length=n[1]), | |
- 1, n[2]) | |
- yh = Compat.repeat(Compat.range(origo[2] + .5*dx[2], | |
- stop=origo[2] + L[2] - .5*dx[2], | |
- length=n[2])', | |
- n[1], 1) | |
- end | |
+ xh = repeat(Compat.range(origo[1] + .5*dx[1], | |
+ stop=origo[1] + L[1] - .5*dx[1], | |
+ length=n[1]), | |
+ outer=[1, n[2]]) | |
+ yh = repeat(Compat.range(origo[2] + .5*dx[2], | |
+ stop=origo[2] + L[2] - .5*dx[2], | |
+ length=n[2])', | |
+ outer=[n[1], 1]) | |
zl = -Compat.range(.5*dx[3], stop=L[3] - .5*dx[3], length=n[3]) | |
zi = -Compat.range(0., stop=L[3], length=n[3] + 1) |