NetCDF4 Fortran library may compile successfully and run for simple programs but segfault on programs where HDF5 is linked directly as well as NetCDF4.
A reason one might directly link both HDF5 and NetCDF is a program that need to read / write files in HDF5 as well as NetCDF format.
The symptom observe thus far is the program segfault on nf90_open().
The fix is to compile HDF5 and NetCDF for yourself.
Gfortran 9.3.0 is sensitive to overlapping / duplicated use elements in a module - submodule hierarchy.
That is, if a procedure is used in multiple places in the module - submodule hierarchy, only use the procedure once at the highest necessary level of the hierarchy.
This is perhaps best shown by example:
modulefooimplicitnone(type,external)containssubroutinebar()endsubroutinebarendmodulefoomoduleparentusefoo,only:barimplicitnone(type,external)interfacemodulesubroutinebazendsubroutinebazendinterfaceendmoduleparentsubmodule(parent)childusefoo,only:bar!< this is unnecessary and triggers the Gfortran 9.3.0 error
implicitnone(type,external)containsmoduleprocedurebazendprocedurebazendsubmodulechild
The error message from Gfortran 9.3.0 is like:
$ gfortran -c .\dupe.f90
dupe.f90:17:17:
17 | submodule (parent) child
| 1
18 | use foo, only : bar
| 2
Meson projects may contain Python code, including Meson subprojects.
However, the Meson subproject code may not be relevant to the top-level Meson project Python code.
Then, Pytest Python test suites may fail when the subprojects/ directory tree is searched and unwanted tests are run.
Ignore directories with Pytest: while this example is for Meson subprojects, it is obviously applicable to many other Python projects.
Add to file “pyproject.toml” in project top-level directory:
Paramiko Python SSH library provides a convenient
SFTPClient
that allows easy transfer of files over SSH.
A distinction from the command line utility
sftp
is that “put"ing a file must include the full destination path including filename, to avoid OSError.
This Paramiko example shows copying a file from local computer to remote computer over SSH in Python.
fromparamikoimport SSHClient
source = "foo.txt"dest = "~/Documents/foo.txt"with SSHClient() as ssh:
ssh.load_system_host_keys()
ssh.connect("server.invalid")
with ssh.open_sftp() as sftp:
sftp.put(source, dest)
Matlab can
generate dependency graphs
and export to GraphML files.
The GUI dependency analyzer also shows missing variable and function definitions for the whole project in one view.
The implicit static analysis of the dependency analyzer seems to be more thorough than the command
requiredFilesAndProducts.
Even if you don’t typically use the Matlab “Project” feature, it’s useful for quality assurance to run this tool on Matlab code to find hidden problems that escape the imperfect nature of unit tests.
Regardless of coding language, we use a layered approach for code quality assurance including static analysis, unit tests and integration tests.
We might choose to suppress DeprecationWarning in a repo’s test suite because the warnings are coming from modules developed by others (e.g. Numpy or Xarray).
However, don’t be too carte blanche about suppressing DeprecationWarning.
Python
breakpoint()
abstracts away pdb.set_trace() and allows use of other debuggers.
breakpoint() also works well with Pytest to conditionally break into code.
x=1y=0breakpoint()
z = x/y
breakpoint() is immediately clear as to its purpose.