Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .codecov.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI
on:
pull_request:
push:
branches:
- master
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
env:
PYTHON:
- uses: julia-actions/julia-runtest@v1
env:
PYTHON:
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
24 changes: 24 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'

jobs:
CompatHelper:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
7 changes: 5 additions & 2 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: TagBot
on:
schedule:
- cron: 0 0 * * *
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

43 changes: 0 additions & 43 deletions appveyor.yml

This file was deleted.

3 changes: 1 addition & 2 deletions src/YAXArrayBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ function __init__()

@require NetCDF="30363a11-5582-574a-97bb-aa9a979735b9" include("datasets/netcdf.jl")



@require CfGRIB="b476ad61-2aff-463c-b862-1d4433a0d503" include("datasets/grib.jl")

end

Expand Down
49 changes: 49 additions & 0 deletions src/datasets/grib.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using .CfGRIB: CfGRIB
using DiskArrays: AbstractDiskArray, DiskArrays, GridChunks
# Define a DiskArray version of OnDiskArray, which is actually a subtype of AbstractArray
struct CFDiskVariable{T,N} <: AbstractDiskArray{T,N}
a::CfGRIB.OnDiskArray
s::NTuple{N,Int}
cs::GridChunks{N}
end
function CFDiskVariable(d::CfGRIB.OnDiskArray)
s = size(d)
N = length(s)
cs = reverse(DiskArrays.estimate_chunksize(reverse(s), sizeof(d.dtype)))
CFDiskVariable{d.dtype,N}(d, s, GridChunks(s,cs))
end
Base.size(v::CFDiskVariable) = v.s
DiskArrays.eachchunk(b::CFDiskVariable) = b.cs
DiskArrays.haschunks(::CFDiskVariable) = DiskArrays.Chunked()
function DiskArrays.readblock!(b::CFDiskVariable,aout,r::AbstractUnitRange...)
res = b.a[r...]
aout .= reshape(res, size(aout))
nothing
end

#And implement the Dataset interface
struct CfGRIBDataset
ds::CfGRIB.DataSet
end
YAXArrayBase.to_dataset(::Type{CfGRIBDataset},p::String) = CfGRIBDataset(CfGRIB.DataSet(p))
toarray(a::CfGRIB.OnDiskArray) = CFDiskVariable(a)
toarray(a) = a
toarray(a::Number) = fill(a)
function YAXArrayBase.get_var_handle(ds::CfGRIBDataset, name)
toarray(ds.ds.variables[string(name)].data)
end
Base.haskey(ds::CfGRIBDataset, k) = haskey(ds.ds.variables, k)

YAXArrayBase.get_varnames(ds::CfGRIBDataset) = collect(keys(ds.ds.variables))

YAXArrayBase.get_var_dims(ds::CfGRIBDataset, k) = ds.ds.variables[k].dimensions

function YAXArrayBase.get_var_attrs(ds::CfGRIBDataset,name)
ds.ds.variables[string(name)].attributes
end

using YAXArrayBase: backendlist, backendregex
backendlist[:GRIB] = CfGRIBDataset
push!(backendregex,r".grb$"=>CfGRIBDataset)
push!(backendregex,r".grib$"=>CfGRIBDataset);