<commit_before>User-Defined Formats for NetCDF {#user_defined_formats}
===============================

[TOC]

User-Defined Formats {#udf_user_defined_formats}
=====================================

## Introduction {#udf_Introduction}

User-defined formats allow users to write their own adaptors for the
netCDF C library, so that it can read and (optionally) write a
proprietary format through the netCDF API.

User-defined format code is packaged into a separate library, the
user-defined format dispatch library. This library, when linked with
the netCDF library, will allow user programs to read their proprietary
format through the netCDF API. The proprietary format is treated as if
it were one of the netCDF C library native binary formats.

Coding the user-defined format dispatch library requires knowledge of
the netCDF library internals. User-defined format dispatch libraries
must be written in C.

### Magic Numbers

Some file formats use the first few bytes of the file as an identifier
for format. For example, HDF5 files have "HDF5" as the fist 4 bytes,
and netCDF classic files have "CDF1" as the first four bytes. This is
called the "magic number" of the file.

User-defined formats can optionally support magic numbers. If the
user-defined format uses a magic number, and that magic number is
associated with the user-defined format, then netCDF will be able to
correctly identify those files from nc_open(). It will not be
necessary for the user to know or specify the underlying format.

## Using User-Defined Formats from C Programms {#udf_With_C}<commit_msg>Add warning about user formats<commit_after>User-Defined Formats for NetCDF {#user_defined_formats}
===============================

[TOC]

User-Defined Formats {#udf_user_defined_formats}
=====================================

## Introduction {#udf_Introduction}

User-defined formats allow users to write their own adaptors for the
netCDF C library, so that it can read and (optionally) write a
proprietary format through the netCDF API.

This capability is currently experimental. It involves the exposing of internal
netcdf interfaces and data structures that were previously invisible to users.
This means that it is unstable and the exposed interfaces are subject to change.
Use with caution.

User-defined format code is packaged into a separate library, the
user-defined format dispatch library. This library, when linked with
the netCDF library, will allow user programs to read their proprietary
format through the netCDF API. The proprietary format is treated as if
it were one of the netCDF C library native binary formats.

Coding the user-defined format dispatch library requires knowledge of
the netCDF library internals. User-defined format dispatch libraries
must be written in C.

### Magic Numbers

Some file formats use the first few bytes of the file as an identifier
for format. For example, HDF5 files have "HDF5" as the fist 4 bytes,
and netCDF classic files have "CDF1" as the first four bytes. This is
called the "magic number" of the file.

User-defined formats can optionally support magic numbers. If the
user-defined format uses a magic number, and that magic number is
associated with the user-defined format, then netCDF will be able to
correctly identify those files from nc_open(). It will not be
necessary for the user to know or specify the underlying format.

## Using User-Defined Formats from C Programms {#udf_With_C}
{'fraction_non_alphanumeric': 0.07853403141361257, 'fraction_numerical': 0.002326934264107039, 'mean_word_length': 5.043936731107205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2617521', 'n_tokens_mistral': 885, 'n_tokens_neox': 849, 'n_words': 488}