Skip to content

autogenerate Riemann solver doctrings from the Fortan source #185

@cbm755

Description

@cbm755

Background

For the _py Riemann solvers that are written in python, I can get live help:

from clawpack import riemann

riemann.euler_1D_py?

which then shows me the docstring including lots of nice info.

But riemann.traffic_1D? gives much less helpful info:

Type:        module
String form: <module 'clawpack.riemann.traffic_1D' from '/home/cbm/.local/lib/python3.13/site-packages/clawpack/riemann/traffic_1D.cpython-313-x86_64-linux-gnu.so'>
File:        ~/.local/lib/python3.13/site-packages/clawpack/riemann/traffic_1D.cpython-313-x86_64-linux-gnu.so
Docstring:  
This module 'traffic_1D' is auto-generated with f2py (version:2.3.5).
Functions:
    wave,s,amdq,apdq = rp1(maxm,num_waves,num_ghost,num_cells,ql,qr,auxl,auxr,num_eqn=shape(ql, 0),num_aux=shape(auxl, 0))
COMMON blocks:
  /cparam/ umax

(and similarly for the other f2py modules).

Fortran source has docs

However, in, for example, rp1_traffic.f90, I see useful stuff:

! Riemann solver for the LWR traffic model:

! q_t + (u_max q(1-q))_x = 0

! waves: 1
! equations: 1

! Conserved quantities:
!       1 q

! The speed limit umax should be in the common block cparam.

! See http://www.clawpack.org/riemann.html for a detailed explanation
! of the Riemann solver API.

Proposal

I imagine its possible, and perhaps even easy, to pull the fortran comments into the docstring dynamically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions