Skip to content

Fix issues #4 to #10 - #16

Merged
balen merged 11 commits into
mainfrom
fix-issues-4-to-10
Nov 18, 2026
Merged

balen merged 11 commits into
mainfrom
fix-issues-4-to-10

Conversation

@VickyS08

Copy link
Copy Markdown
Contributor

One commit per issue; each says 'Fixes #n', so issues #4 to #10 close when this is merged. All tests pass on Python 3.10 and 3.14.

VickyS08 and others added 11 commits November 18, 2026 21:39
Database exports name fields with the hour (attached_thermometer_7am) and
also give it in the date/time column (07:00). The two were joined into
"attached_thermometer_7am 07:00", which could not be read as a time, so
every fixed-hour reading was written as a daily value.

When the joined name can't be read and the field name ends in a clock time
(7am, 2pm, 9:00) or a named time (sunrise, noon), the name is now read
without it and the time column is used. If they disagree, check reports
it and the time column is used. Bare numbers (casual_phenomena_line_2,
barometer_observed_117, ..._9pm_1) are not taken as times. Aliases that
include the hour (the earlier workaround) still work as before.

Checked on York Factory 1876 and Red River Settlement 1844-61: metadata
without the hour in the aliases now gives SEF files identical to the
workaround. New test: test_hour_in_field_name.

Fixes #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
The description joined the characters of the single Author-email string
("Authors: V, i, c, k, y, ..."). It now reads the names from it:
"Authors: Vicky Slonosky, Hervé Hacot." --help and --version also work
when csv2sef is run from the source folder without being installed.

New test: test_help_authors.

Fixes #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
pyproject.toml (shown by --help and on PyPI) and the README author line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
These values were reported as unmapped in direction columns:

- -999 (and -999.9) is now missing, and -888 an instrument error, as in
  number columns.
- "hidden" (also obscured, haze, fog, smoke, mist): fog or thick lower
  clouds hide the higher clouds, so their direction can't be seen. Value
  missing, flag "hidden" (Table 5 of the paper).
- "clear" in a cloud-direction column: no clouds. Same value as "none"
  (Calm), flag "no clouds". In a wind-direction column it stays unmapped.

York Factory 1876: the 256 unmapped "hidden" values are now flagged hidden.
Red River 1844-61: unmapped values drop from 324 to 165 (the rest are
weather remarks and a few transcription notes such as "empty 0").

New test: test_direction_values; three known values added.

Fixes #7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
In cloud-direction and cloud-type columns (cd, hd, c, cl, ch), "none" now
means no clouds, as "clear" does: Calm with flag "no clouds" for a
direction, Cl0 / Ch0 for a cloud type (Table 5: None; Clear = 0). In every
other column "none" stays a missing value (Table 7).

Tests and known values added.

Part of #7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
In cloud-amount columns (n, nl, nh, hl), in tenths or oktas, "none" now
means no clouds = 0, as in cloud-direction and cloud-type columns.
Clearness of sky (skc) is left as missing: there "none" could mean no
clear sky. Other columns are unchanged ("none" = missing).

Part of #7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
Some registers give wind direction and force in one cell ("south 1",
"north-west 2"; Red River Settlement 1844-45). The direction part was
already read in direction columns, but the force was marked invalid
because the Smithsonian / Beaufort converters tried to read "south" as a
number. When a force cell starts with a compass direction, the number
after it is now used, and the log notes it.

Red River Settlement 1844-61: 688 of the 691 invalid wind forces are now
converted (the other 3 invalid values are transcription notes).

New test: test_direction_and_force.

Fixes #6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
- Wind forces with a fraction ("south-east 1/2", "2 1/2"): the Smithsonian
  and Beaufort scales have no fractions, so the force is rounded down and
  flagged "fraction rounded down" (it was rounded down silently).
- "redacted" (text struck through in the register) is a missing value.

Part of #6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
A header typed with a tab after each comma (easy to get in a text editor)
made csv2sef read the whole file as tab-separated, so the first column was
called "Date," and the error was "no date columns found". The separator
(comma, semicolon or tab) is now judged from the header and up to five
data lines, so the data decide. Stray tabs in header names are then
removed by the usual clean-up.

The "no date columns" error now lists the columns it read and suggests
checking the separators.

New test: test_separators.

Fixes #8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
A barometer column marked [mm] (meaning mmHg) was read as millimetres of
precipitation: no conversion to hPa, and every value flagged as low
pressure. For pressure and vapour-pressure variables, a length unit (mm,
in) is now read as millimetres / inches of mercury, and check says so
("unit 'mm' read as mmHg ...; write [mmHg] to avoid this note"). The same
applies to units given by unit_change. Rain and snow are unchanged.

Hebron 1883 with [mm] headers: 0 flagged values instead of 358.

New test: test_mm_on_pressure.

Fixes #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
Values in a unit_change period were converted correctly, but the check
table only showed the column's main unit. Each column now lists the
unit_change lines that apply to it, with the number of values affected:

    Air_Temperature 08:00 [R]    ta   08:00  R  header  C ...
        > unit De_frz from 1742-11-01 to 1753-12-31 (unit_change): 1746 value(s)

New test: test_unit_change_in_check.

Fixes #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CC13ToxZ7NuJEZJX9urApc
@balen
balen merged commit b33e38a into main Nov 18, 2026
1 check passed
@balen
balen deleted the fix-issues-4-to-10 branch November 18, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants