Skip to content

Expose DSID product specification subfields (PRSP, PSDN, PRED, PROF) - #18

Merged
philliphoff merged 1 commit into
mainfrom
feat/s57-dsid-product-specification
Sep 16, 2026
Merged

philliphoff merged 1 commit into
mainfrom
feat/s57-dsid-product-specification

Conversation

@philliphoff

Copy link
Copy Markdown
Owner

Fixes #17. This is needed for inland ENC support in philliphoff/EncDotNet.S100#608.

Changes

  • S57DataSetIdentification: four new properties, added after the existing ones:
    • ProductSpecification (PRSP, int). The docs note that S-57 §7.3.1.1 enumerates 1 = ENC and 2 = ODD, and that inland ENC producers declare 10.
    • ProductSpecificationDescription (PSDN, string)
    • ProductSpecificationEdition (PRED, string)
    • ApplicationProfile (PROF, int)
  • S57DocumentReader: populates the new properties with the same TryGetSubfield pattern used for AGEN / COMT, defaulting to 0 / empty when a subfield is absent.
    • Handling of PRSP and PROF: their binary form is b11, but their ASCII form is a mnemonic (A(3) ENC/ODD, A(2) EN/ER/DD).
    • Reading them with byte, as INTU is read, would throw on an ASCII cell.
    • So they are read as strings (the field reader turns a binary value into its decimal text) and mapped to the numeric code. Digits such as 10 are parsed directly, and unknown values become 0.
  • Doc fix: ProducingAgency now says (AGEN) instead of (PRSP).
  • README: not changed, because it doesn't list DSID members.

Tests

New tests in S57DocumentReaderTests use synthetic data only:

  • Binary DSID: PRSP / PSDN / PRED / PROF values for NOAA (1, "2.0") and inland (10, "2.4") are read correctly.
  • ASCII-form DSID: the mnemonics ENC/ODD/EN/ER/DD and a numeric 10 map to the right codes.
  • DSID definition without the four subfields: the properties default to 0 / empty.

I ran the tests with dotnet test tests/EndDotNet.UnitTests in the repo on macOS. The NU1605 restore error did not occur, so the scratch project was not needed. All 492 tests pass.

Both format gates are clean:

  • dotnet format whitespace EncDotNet.slnx --verify-no-changes
  • dotnet format style EncDotNet.slnx --diagnostics IDE0005 --severity warn --verify-no-changes

Add ProductSpecification, ProductSpecificationDescription,
ProductSpecificationEdition and ApplicationProfile to
S57DataSetIdentification and populate them in S57DocumentReader for both
binary and ASCII lexical forms. Fix the ProducingAgency doc comment to
cite AGEN instead of PRSP.

Fixes #17
@philliphoff
philliphoff merged commit c403c0e into main Sep 16, 2026
7 checks passed
@philliphoff
philliphoff deleted the feat/s57-dsid-product-specification branch September 16, 2026 18:00
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.

Expose DSID product specification subfields (PRSP, PSDN, PRED, PROF)

1 participant