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
4 changes: 4 additions & 0 deletions src/epochs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ for f in (:year, :month, :day, :hour, :minute, :second, :millisecond)
@eval Dates.$f(epoch::CDFDateTime) = Dates.$f(DateTime(epoch))
end

Epoch(s::AbstractString) = Epoch(DateTime(s))
Epoch16(s::AbstractString) = Epoch16(DateTime(s))
TT2000(s::AbstractString) = TT2000(DateTime(s))

Dates.value(epoch::Epoch) = epoch.instant
Dates.value(epoch::Epoch16) = ComplexF64(epoch.seconds, epoch.picoseconds)
Dates.value(epoch::TT2000) = epoch.instant.value
Expand Down
25 changes: 15 additions & 10 deletions src/loading/attribute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ function vattrib(cdf::CDFDataset, varnum::Integer)
for offset in offsets
is_global(buffer, offset, RecordSizeType) && continue
adr = ADR(buffer, offset, RecordSizeType)
@assert min(adr.AgrEDRhead, adr.AzEDRhead) == 0
head = max(adr.AgrEDRhead, adr.AzEDRhead)
found = _search_aedr_entries(buffer, head, RecordSizeType, cdf_encoding, varnum)
isnothing(found) && continue
name = String(adr.Name)
attributes[name] = _get_attributes(name, found, cdf)
for head in (adr.AgrEDRhead, adr.AzEDRhead)
head == 0 && continue
found = _search_aedr_entries(buffer, head, RecordSizeType, cdf_encoding, varnum)
isnothing(found) && continue
name = String(adr.Name)
attributes[name] = _get_attributes(name, found, cdf)
break
end
end
return attributes
end
Expand Down Expand Up @@ -101,10 +103,13 @@ function vattrib(cdf, varnum, name)
is_global(buffer, offset, RecordSizeType) && continue
adr = ADR(buffer, offset, RecordSizeType)
adr.Name != name_bytes && continue
@assert min(adr.AgrEDRhead, adr.AzEDRhead) == 0
head = max(adr.AgrEDRhead, adr.AzEDRhead)
value = _search_aedr_entries(buffer, head, RecordSizeType, cdf_encoding, varnum)
return _get_attributes(name, value, cdf)
for head in (adr.AgrEDRhead, adr.AzEDRhead)
head == 0 && continue
found = _search_aedr_entries(buffer, head, RecordSizeType, cdf_encoding, varnum)
isnothing(found) && continue
return _get_attributes(name, found, cdf)
end
return nothing
end
return nothing
end
Expand Down
Loading