Means to determine a read-in field's source file format
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 150
- Forks
- 23
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Description
We support specification of a netCDF file format to write out to, but as far as I can see (I may be missing something obvious) there is no way in cf-python to determine, for read-in fields, the data model underlying the source file, e.g. the type of netCDF (classic, 64-bit offset, netCDF-4, CFA varaiants, etc.) else the .pp & .ff proprietary formats with any variants, as that does not appear to be encoded in the metadata.
I think users may be interested in this information, for example to know immediately based on the format whether there will be groups, etc. without having to inspect the group structure. So, similar to the source method on a field providing detail on the method of production of the original data, I propose a source_fmt or source_storage (or similar) method to return that information, assuming it is not overly difficult to determine that information when the file is read-in.
Some utility similar to that provided by shell-command inspection of the first four bytes of the file, and/or the ncdump -k option (based on the netCDF docs FAQ section 'How can I tell which format a netCDF file uses?'):
$ ncdump -k classic_file.nc
classic
$ ncdump -k netCDF4_file.nc
netCDF-4
to report the file format corresponding to fields read-in from a given file could be useful. For example, f.source_storage providing the format as a named string such as those listed as fmt for cf.write in the case of netCDF.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the read-in field handling alongside the existing source method and the fmt options of cf.write. Compare the available format information with the ncdump -k and first-four-bytes approaches described in the issue. Done means read-in fields expose a named source format for the listed netCDF and proprietary variants.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100