NCAS-CMS / NCAS-CMS/cf-python

Wierd behaviour by cf-dump

Open
#770 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

The output of cf-dump seems to be seeing some sort of escaping and not liking it. Problem manifests in a docker container (you can use the atmbnl/datatools container to see it?

!cfdump mars-era-teaching2023.nc
/opt/conda/envs/datatools/bin/cfdump:14: SyntaxWarning: invalid escape sequence '\-'
  manpage = """\
/opt/conda/envs/datatools/bin/cfdump:108: SyntaxWarning: invalid escape sequence '\ '
  " Manual page cfdump(1)\ ?ltline\ %lt?L/%L.:",
Field: air_pressure_at_mean_sea_level (ncvar%msl)
...

So it doesn't like it, then does the right thing ... so the bug is the spurious warning error message!

Environment:

python
Python 3.12.3 | packaged by conda-forge | (main, Apr 15 2024, 18:38:13) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cf
>>> cf.__version__
'3.17.0'
>>> 

(But this is the "special" version using

RUN pip install git+https://github.com/davidhassell/cfdm@h5-read-0
RUN pip install git+https://github.com/davidhassell/cf-python@active-storage-0

)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning with the atmbnl/datatools container and inspect the cf-dump entry point shown in the traceback. Identify the source of the invalid escape sequences, then verify that cf-dump produces the same field output without SyntaxWarning messages under Python 3.12.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.