Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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
12 changes: 8 additions & 4 deletions test/ASCAT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ end
Dict("num_band" => 3, "xtrack" => 82)
@test MetopDatasets.get_field_dimensions(MetopDatasets.ASCA_SZR_1B_V13, :sigma0_trip) ==
["num_band", "xtrack"]
@test MetopDatasets.get_field_dimensions(MetopDatasets.ASCA_SZR_1B_V13, :abs_line_number) ==
@test MetopDatasets.get_field_dimensions(
MetopDatasets.ASCA_SZR_1B_V13, :abs_line_number) ==
String[]
@test MetopDatasets.get_description(MetopDatasets.ASCA_SZR_1B_V13, :sigma0_trip) ==
"Sigma0 triplet, re-sampled to swath grid, for 3 beams (fore, mid, aft) "
Expand All @@ -58,8 +59,10 @@ end

@test MetopDatasets.native_sizeof(MetopDatasets.ASCA_SZF_1B_V13) == 4256
@test test_dimensions(MetopDatasets.ASCA_SZF_1B_V13)
@test MetopDatasets.get_scale_factor(MetopDatasets.ASCA_SZF_1B_V13, :inc_angle_full) == 2
@test MetopDatasets.get_dimensions(MetopDatasets.ASCA_SZF_1B_V13) == Dict("xtrack" => 192)
@test MetopDatasets.get_scale_factor(MetopDatasets.ASCA_SZF_1B_V13, :inc_angle_full) ==
2
@test MetopDatasets.get_dimensions(MetopDatasets.ASCA_SZF_1B_V13) ==
Dict("xtrack" => 192)

@test MetopDatasets.native_sizeof(MetopDatasets.ASCA_SZF_1B_V12) == 3684
@test test_dimensions(MetopDatasets.ASCA_SZF_1B_V12)
Expand All @@ -83,7 +86,8 @@ end

function get_data_record_type(file)
data_record_type = open(file, "r") do file_pointer
main_header = MetopDatasets.native_read(file_pointer, MetopDatasets.MainProductHeader)
main_header = MetopDatasets.native_read(
file_pointer, MetopDatasets.MainProductHeader)
return MetopDatasets.data_record_type(main_header)
end
return data_record_type
Expand Down
9 changes: 6 additions & 3 deletions test/IASI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ import CommonDataModel as CDM
@test ds["ggeosondloc"][1, 1, 1, 1]≈156 atol=1 # test first longitude in file
@test ds["ggeosondloc"][2, 1, 1, 1]≈-52 atol=1 # test first latitude in file

@test sort(CDM.dimnames(ds)) == ["atrack", "avhrr_channel", "avhrr_image_column", "avhrr_image_line", "band",
"corner_cube_direction", "eigenvalue", "fov_class", "integrated_imager_column", "integrated_imager_line",
"line_column", "lon_lat", "sounder_pixel", "spectral", "subgrid_imager_pixel", "xtrack", "zenith_azimuth"]
@test sort(CDM.dimnames(ds)) ==
["atrack", "avhrr_channel", "avhrr_image_column", "avhrr_image_line", "band",
"corner_cube_direction", "eigenvalue", "fov_class",
"integrated_imager_column", "integrated_imager_line",
"line_column", "lon_lat", "sounder_pixel", "spectral",
"subgrid_imager_pixel", "xtrack", "zenith_azimuth"]
@test CDM.dim(ds, :spectral) == 8700
@test CDM.dim(ds, "atrack") == ds.main_product_header.total_mdr

Expand Down
3 changes: 2 additions & 1 deletion test/auto_generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ eval(MetopDatasets.record_struct_expression(

# test fallback functions for dimensions
@test MetopDatasets.get_dimensions(TEST_FORMAT) == Dict("dim_1" => 3, "dim_2" => 82)
@test MetopDatasets.get_field_dimensions(TEST_FORMAT, :sigma0_trip) == ["dim_1", "dim_2"]
@test MetopDatasets.get_field_dimensions(TEST_FORMAT, :sigma0_trip) ==
["dim_1", "dim_2"]
@test MetopDatasets.get_field_dimensions(TEST_FORMAT, :latitude) == ["dim_2"]
@test MetopDatasets.get_field_dimensions(TEST_FORMAT, :utc_line_nodes) == String[]

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