Skip to content

[scripts] Fix SyntaxWarning in extract_ptravers_res_to_geoc script

Nicolas Godet requested to merge fix-SyntaxWarning into main

Description

Calling converter.py raises a SyntaxWarning:

(TELEMAC v8p5r0) godet@islcalx:~$ converter.py
/slurm/opt/telemac-mascaret/v8p5r0/scripts/python3/data_manip/extraction/extract_ptravers_res_to_geoc.py:64: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if output_name.split(".")[-1] is not "geoC":
/slurm/opt/telemac-mascaret/v8p5r0/scripts/python3/data_manip/extraction/extract_ptravers_res_to_geoc.py:67: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if output_name is '_prev.geoC':
usage: converter.py [-h] [-c config name] [-f config file] [-r TELEMAC root]
                    {ecmwf2srf,gebco2srf,hycom2srf,kenue2shp,dat2vtu,generate_atm,generate_bnd,srf2med,srf2vtk,med2srf,med2srfd,refine,sis2gaia,xml2py,extract_ptravers_res_to_geoc,convert_listing_courlis,report2xls,shp2i2s,shp2txt,txt2shp}
                    ...

This PR fixes the warnings. A NEWS.txt entry might not be necessary.

Checklist

All Merge Requests:

  • Update NEWS.txt to describe your changes.
  • Run compile_telemac.py --check-code to check FORTRAN coding conventions.
  • Run pylint to check Python coding conventions.
  • If you added new files, run compile_telemac.py --clean --rescan and commit the updated cmdf file(s) accordingly.
  • Run compile_telemac.py --clean for both normal and debug configurations.
  • Run validate_telemac.py for both normal and debug configurations.
  • Run validate_telemac.py --notebook for both normal and debug configurations.
  • Run doc_telemac.py if there are any modifications in the documentation.
  • Run damocles.py --eficas if there are any modifications in the dictionaries.

Additionnaly, for a new feature:

  • Check that your feature works in both serial and parallel modes.
  • Add at least one test case to check the functionality (with documentation, graphics and VnV script)
  • Update the documentation for the module in which your feature will be available.

Merge request reports