Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MetopDatasets"
uuid = "0c26954c-4046-4b98-a13c-f9377ca4b9b7"
authors = ["lupemba <simon.koklupemba@eumetsat.int> and contributors"]
version = "0.0.5"
version = "0.0.6"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ The package is implemented based on
To read a Metop Native binary file:

```julia
julia> using MetopDatasets

julia> ds = MetopDataset("ASCA_SZR_1B_M01_20190109125700Z_20190109143858Z_N_O_20190109134816Z.nat")

using MetopDatasets
ds = MetopDataset("ASCA_SZR_1B_M01_20190109125700Z_20190109143858Z_N_O_20190109134816Z.nat")
```
REPL output:
```
Dataset:
Group: /

Expand Down Expand Up @@ -313,24 +314,33 @@ Global attributes
The variables can be loaded from MetopDataset by indexing the dataset. The variable then works as a lazy array loading the data on indexing:

```julia
julia> ds["latitude"][2,4];
ds["latitude"][2,4]
```
REPL output:
```
66.707944

julia> ds["latitude"][:,:]
```
It is also possible to load the complete array
```julia
ds["latitude"][:,:]
```
REPL output:
```
82×3264 Matrix{Float64}:
66.862 66.7841 66.706 66.6276 66.5489 … 65.6304 65.5487 65.4667 65.3844 65.3019
66.9431 66.865 66.7866 66.7079 66.629 65.7077 65.6257 65.5434 65.4609 65.3782
⋮ ⋱ ⋮
74.2237 74.1153 74.007 73.8986 73.7903 … 72.5493 72.4409 72.3325 72.2241 72.1157
74.2342 74.1259 74.0175 73.9092 73.8008 72.5597 72.4513 72.3429 72.2345 72.1261
```

Data from the main product header is accessed as attributes.
```julia
julia> ds.attrib["instrument_id"]
ds.attrib["instrument_id"]
```
REPL output:
```
"ASCA"
```

### Convert a Metop Native binary file to netCDF

A Metop Native binary file can be converted to netCDF using the [NCDatasets.jl](https://github.com/Alexander-Barth/NCDatasets.jl) package. This
Expand Down
3 changes: 1 addition & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ makedocs(;

deploydocs(;
repo = "github.com/eumetsat/MetopDatasets.jl",
devbranch = "main",
push_preview = true
devbranch = "main"
)
5 changes: 4 additions & 1 deletion src/auto_generate_tools/auto_generate_tool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ function _get_field_name(row::CSV.Row)
return Symbol(lowercase(replace(row.FIELD, ' ' => '_')))
end

function _get_description(row::CSV.Row)
function _get_description(row::CSV.Row)::AbstractString
if ismissing(row.DESCRIPTION)
return ""
end
return row.DESCRIPTION
end

Expand Down
2 changes: 2 additions & 0 deletions test/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ end
netcdf_file = tempname(; cleanup = true)

# convert file to netCDF
# TODO fix warnings. DiskArrays gives a warning because BitString is converted to a string and strings
# are not a Base.isbitstype()
MetopDataset(test_file) do ds_nat
NCDataset(netcdf_file, "c") do ds_temp
NCDatasets.write(ds_temp, ds_nat)
Expand Down
3 changes: 2 additions & 1 deletion test/main_product_header.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ using MetopDatasets, Test, Dates
test_files = "testData/ASCA_SZO_1B_M03_20230329063300Z_20230329063556Z_N_C_20230329081417Z"

main_header, bytes_read = open(test_files, "r") do file_pointer
main_header = MetopDatasets.native_read(file_pointer, MetopDatasets.MainProductHeader)
main_header = MetopDatasets.native_read(
file_pointer, MetopDatasets.MainProductHeader)
return main_header, position(file_pointer)
end

Expand Down
6 changes: 4 additions & 2 deletions test/record_chunks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ using MetopDatasets, Test
total_size,
data_record_type)

datarecord_chunks = filter(x -> x.record_type != MetopDatasets.DummyRecord, record_chunks)
datarecord_chunks = filter(
x -> x.record_type != MetopDatasets.DummyRecord, record_chunks)
dummyrecord_chunks = filter(x -> x.record_type == MetopDatasets.DummyRecord,
record_chunks)

Expand Down Expand Up @@ -159,7 +160,8 @@ end
total_size,
data_record_type)

datarecord_chunks = filter(x -> x.record_type != MetopDatasets.DummyRecord, record_chunks)
datarecord_chunks = filter(
x -> x.record_type != MetopDatasets.DummyRecord, record_chunks)
dummyrecord_chunks = filter(x -> x.record_type == MetopDatasets.DummyRecord,
record_chunks)

Expand Down