Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doxygen marked-down source #586

Open
MatthewMasarik-NOAA opened this issue Jan 19, 2022 · 56 comments · Fixed by #748
Open

Add doxygen marked-down source #586

MatthewMasarik-NOAA opened this issue Jan 19, 2022 · 56 comments · Fixed by #748

Comments

@MatthewMasarik-NOAA
Copy link
Collaborator

MatthewMasarik-NOAA commented Jan 19, 2022

Add Doxygen Documentation

For each file, document each contained Fortran code units (file, module, subroutine, etc.) using the agreed upon doxygen headers:

  • ctest.F90 (paused, to be outdated.)
  • pdlib_field_vec.F90
  • serv_xnl4v5.f90
  • w3arrymd.F90
  • w3dispmd.F90
  • w3fld1md.F90
  • w3fld2md.F90
  • w3fldsmd.F90
  • w3gdatmd.F90
  • w3getmem.c
  • w3gig1md.F90
  • w3gkemd.F90
  • w3gridmd.F90
  • w3gsrumd.F90
  • w3macros.h
  • w3meminfo.F90
  • w3nmlbouncmd.F90
  • w3nmlgridmd.F90
  • w3nmlmultimd.F90
  • w3nmlounfmd.F90
  • w3nmlounpmd.F90
  • w3nmlprncmd.F90
  • w3nmlshelmd.F90
  • w3nmltrncmd.F90
  • w3nmluprstrmd.F90
  • w3oacpmd.F90
  • w3odatmd.F90
  • w3ogcmmd.F90
  • w3profsmd.F90
  • w3profsmd_pdlib.F90
  • w3servmd.F90
  • w3sic3md.F90
  • w3sic5md.F90 (troubleshooting)
  • w3sis2md.F90 (troubleshooting)
  • w3strkmd.F90 (MatthewMasarik-NOAA)
  • w3tidemd.F90 (MatthewMasarik-NOAA)
  • w3timemd.F90 (MatthewMasarik-NOAA)
  • w3uostmd.F90 (troubleshooting)
  • wmesmfmd.F90 (troubleshooting)
  • PDLIB/yowdatapool.F90
  • PDLIB/yowelementpool.F90
  • PDLIB/yowerr.F90
  • PDLIB/yowexchangeModule.F90
  • PDLIB/yowfunction.F90
  • PDLIB/yownodepool.F90
  • PDLIB/yowpd.F90
  • PDLIB/yowpdlibmain.F90
  • PDLIB/yowrankModule.F90
  • PDLIB/yowsidepool.F90
  • SCRIP/scrip_constants.f
  • SCRIP/scrip_errormod.f90
  • SCRIP/scrip_grids.f
  • SCRIP/scrip_interface.F90
  • SCRIP/scrip_iounitsmod.f90
  • SCRIP/scrip_kindsmod.f90
  • SCRIP/SCRIP.mk
  • SCRIP/SCRIP_NC.mk
  • SCRIP/scrip_netcdfmod.f90
  • SCRIP/scrip_remap_conservative.f
  • SCRIP/scrip_remap_read.f
  • SCRIP/scrip_remap_vars.f
  • SCRIP/scrip_remap_write.f
  • SCRIP/scrip_timers.f
  • constants.F90
  • gx_outf.F90
  • gx_outp.F90
  • mod_constants.f90
  • mod_fileio.f90
  • mod_xnl4v5.f90
  • w3adatmd.F90
  • w3agcmmd.F90
  • w3bullmd.F90
  • w3canomd.F90
  • w3cspcmd.F90
  • w3flx1md.F90
  • w3flx2md.F90
  • w3flx3md.F90
  • w3flx4md.F90
  • w3flx5md.F90
  • w3idatmd.F90
  • w3igcmmd.F90
  • w3initmd.F90
  • w3iobcmd.F90
  • w3iogomd.F90
  • w3iogrmd.F90
  • w3iopomd.F90
  • w3iorsmd.F90
  • w3iosfmd.F90
  • w3iotrmd.F90
  • w3metamd.F90
  • w3ounfmetamd.F90
  • w3parall.F90
  • w3partmd.F90
  • w3pro1md.F90
  • w3pro2md.F90
  • w3pro3md.F90
  • w3psmcmd.F90
  • w3ref1md.F90
  • w3sbs1md.F90
  • w3sbt1md.F90
  • w3sbt4md.F90
  • w3sbt8md.F90
  • w3sbt9md.F90
  • w3sdb1md.F90
  • w3sic1md.F90
  • w3sic2md.F90
  • w3sic4md.F90
  • w3sis1md.F90
  • w3smcomd.F90
  • w3snl1md.F90
  • w3snl2md.F90
  • w3snl3md.F90
  • w3snl4md.F90
  • w3snl5md.F90
  • w3snlsmd.F90
  • w3src0md.F90
  • w3src1md.F90
  • w3src2md.F90
  • w3src3md.F90
  • w3src4md.F90
  • w3src6md.F90
  • w3srcemd.F90
  • w3str1md.F90
  • w3str2md.F90
  • w3triamd.F90
  • w3uno2md.F90
  • w3updtmd.F90
  • w3uqckmd.F90
  • w3wavemd.F90
  • w3wavset.F90
  • w3wdasmd.F90
  • w3wdatmd.F90
  • wmfinlmd.F90
  • wmgridmd.F90
  • wminiomd.F90
  • wminitmd.F90
  • wmiopomd.F90
  • wmmdatmd.F90
  • wmscrpmd.F90
  • wmunitmd.F90
  • wmupdtmd.F90
  • wmwavemd.F90
  • ww3_bounc.F90
  • ww3_bound.F90
  • ww3_gint.F90
  • ww3_grib.F90
  • ww3_grid.F90
  • ww3_gspl.F90
  • ww3_multi.F90
  • ww3_ounf.F90
  • ww3_ounp.F90
  • ww3_outf.F90
  • ww3_outp.F90
  • ww3_prep.F90
  • ww3_prnc.F90
  • ww3_prtide.F90
  • ww3_sbs1.F90
  • ww3_shel.F90
  • ww3_strt.F90
  • ww3_systrk.F90
  • ww3_trck.F90
  • ww3_trnc.F90
  • ww3_uprstr.F90
@ukmo-ccbunney
Copy link
Collaborator

I'm happy to do the documentation for w3ounfmetamd.F90 and w3metamd.f90.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

MatthewMasarik-NOAA commented Jan 25, 2022

That would be awesome @ukmo-ccbunney . I'll put your username next to those two so folks know it's claimed.

done!

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Jan 25, 2022

Hi @MatthewMasarik-NOAA

I have started to add some doxygen markup to one of the F90 files and tried running doxygen, but I am having a few problems. Is there a minimum version of doxygen that is required?

On my Linux box I have version 1.8.5 but it segfaults when I run it. The last few lines of output are here:

Preprocessing /net/data/users/frey/WW3Git/UKMO_WW3/model/src/w3servmd.F90...
Prepassing fixed form of /net/data/users/frey/WW3Git/UKMO_WW3/model/src/w3servmd.F90
Parsing file /net/data/users/frey/WW3Git/UKMO_WW3/model/src/w3servmd.F90...
********************************************************************
Error in file /net/data/users/frey/WW3Git/UKMO_WW3/model/src/w3servmd.F90 line: 2072, state: 4
********************************************************************
Segmentation fault

On my HPC, I have version 1.5.6 which seems to run, but the documentation for my module does not get generated correctly. It picks up the markup for the file (@brief and @author, etc), but all the entries for the module are not picked up (@brief, @details, @param, etc).

Perhaps I am invoking it wrong? I am simply running doxygen docs/Doxyfile.in from the top level.

Ta!

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Hi @ukmo-ccbunney , hmm, let me have a look. It normally goes off without a hitch, so I'll see if anything needs to be changed in the Doxygen.in. I'll post back momentarily..

@MatthewMasarik-NOAA
Copy link
Collaborator Author

@ukmo-ccbunney , try moving the Doxygen.in file up to the top level, then call doxygen Doxygen.in from there. I think that may solve it because I have the INPUT resource in the Doxygen.in set to model/src. I originally worked with repo in that structure, and transitioned the Doxygen.in file into docs/ during the PR.

Please let me know if that works or not.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Ps, @ukmo-ccbunney I checked version on a linux vm I have and it's 1.8.17. I would think your version would be fine. If you want to push the branch your working on, I could try running it on my end to see if its due to the markup added, or something else like the environment

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Jan 26, 2022

Hmm...same issue unfortunately (exactly the same error message on version 1.8.5 on my Linux box).

Like I say, it sort of works on the older version on my HPC, but my markup for the module is not appearing. Perhaps I am doing something wrong with the markup? I've pushed my changes up to a branch here:

https://github.com/ukmo-waves/WW3/tree/doc/ounfmeta

I've only added markup to the "file" (top level) and the "module" so far. Only the "file" markup is generating any documentation at the moment. If you can have a quick look then that would be great :)

UPDATE:
So - I fixed one issue: I had the doxygen markup defined inside the module/subroutine rather than above it (d'oh). I can now produce a sensible looking html file on my HPC. However, it still segfaults on my linux box with the newer version of doxygen. If I remove all the other *.F90 files from the src directory and only have my single modified file in there, then it works fine. Perhaps I have a buggy version of doxygen? I will continue to update my files and you can try generating the documentation at you end perhaps to see if works ok for you?

UPDATE 2:
So - I have got it to work with v.1.8.5 of doxygen, but to do so I had to remove the following files from my src directory as they were causing errors that resulted in a segfault:

src/w3profsmd.F90
src/w3servmd.F90
src/w3timemd.F90
src/w3triamd.F90
src/wmupdtmd.F90

@MatthewMasarik-NOAA
Copy link
Collaborator Author

@ukmo-ccbunney I'm having a look at the source right now, I'll give some feedback shortly

@ukmo-ccbunney
Copy link
Collaborator

@MatthewMasarik-NOAA Quick update - I have installed a new version of doxygen via Conda and it solves the issue I was having. I still get errors from some files, but it no longer segfaults.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Interesting.. that's good to note the version may be important as others start documenting. I'm working with w3ounfmetamd.F90 and getting some similar behavior -- it's not producing output for file & module. Strange. I'll have it sorted out shortly

@ukmo-ccbunney
Copy link
Collaborator

I have it working for me now - have you tried my most recent commits?

@MatthewMasarik-NOAA
Copy link
Collaborator Author

That's great! Oops, didn't have the most recent.. I'm glad to hear it's working.

Also in your markup you mentioned how to document the module variables. I need to see if I had it right to use the @param tags, I think you may actually use inline comments for each. I'm checking into that, I didn't know module variables needed to be documented until @edwardhartnett commented, possibly he will chime in. I'll report back on it

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Jan 26, 2022

Great - thanks @MatthewMasarik-NOAA .

On a related note - do we have a policy on whether we are ditching the "WAVEWATCH III" header boxes, i.e. these:

!/
!/                  +-----------------------------------+
!/                  | WAVEWATCH III           NOAA/NCEP |
!/                  |           C. Bunney               |
!/                  |                                   |
!/                  |                        FORTRAN 90 |
!/                  | Last update :         09-Nov-2020 |
!/                  +-----------------------------------+

I am hoping we can get rid of them, as they take a lot of space and are repeated for every module/subroutine/function.

Also, are we keeping the change log in the comments, or are we going to rely on Git's commit log for this?

@aliabdolali and @JessicaMeixner-NOAA - do you have any opinions on this?

@JessicaMeixner-NOAA
Copy link
Collaborator

For now the doxygen is just an addition and we're keeping the normal WW3 header and logs. I'd be open to changes though. I'm not a huge fan of the log personally but there are a few comments here/there that are valuable. I'd hope we could keep the important parts of the descriptions.

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Jan 26, 2022

For now the doxygen is just an addition and we're keeping the normal WW3 header and logs. I'd be open to changes though. I'm not a huge fan of the log personally but there are a few comments here/there that are valuable. I'd hope we could keep the important parts of the descriptions.

OK - I have deleted the sections that relate to the new Doxygen tags though (i.e. "1. Purpose", "2. Method", "3. Parameters", etc. I have left the header and the change log though. Should have I left the others untouched too?

@MatthewMasarik-NOAA
Copy link
Collaborator Author

I'd agree with @JessicaMeixner-NOAA , we had some discussions on this. I believe leaving the original headers intact (no markup) and adding some (relatively brief) doxygen markup above them is best. As you noted, the source below the tags is all displayed right below the marked up information.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

OK - I have deleted the sections that relate to the new Doxygen tags though (i.e. "1. Purpose", "2. Method", "3. Parameters", etc. I have left the header and the change log though. Should have I left the others untouched too?

The approach I have been using is to leave the header completely untouched, then copy (or summarize in 1 sentence) the 1. Purpose content into the @brief tag. For the @details, I was putting a couple summarizing sentences from 2. Method, or elsewhere in the header that seemed helpful. I shoot for ~1 paragraph of info. I think there's roof for individual taste here though. Does that get at what you're asking?

@MatthewMasarik-NOAA
Copy link
Collaborator Author

*roof = room

@ukmo-ccbunney
Copy link
Collaborator

OK - I have deleted the sections that relate to the new Doxygen tags though (i.e. "1. Purpose", "2. Method", "3. Parameters", etc. I have left the header and the change log though. Should have I left the others untouched too?

The approach I have been using is to leave the header completely untouched, then copy (or summarize in 1 sentence) the 1. Purpose content into the @brief tag. For the @details, I was putting a couple summarizing sentences from 2. Method, or elsewhere in the header that seemed helpful. I shoot for ~1 paragraph of info. I think there's roof for individual taste here though. Does that get at what you're asking?

Yeah - that's cool and pretty much what I have done. I will reinstate the original comments.

However, if you agree, I will not keep the original comment for the module itself in w3ounfmetamd. It is a very long description of the module and I have moved it to the doxygen @details section to make use of the extra markup available there. Is that ok? I will reinstate all the comments from the subroutines/fcuntions.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

That seems just fine to me. For people documenting their own code you should have some license to how you want it. If you're documenting a someone else's code, we may want to be judicious with what is removed. I think what you mentioned sounds good

@MatthewMasarik-NOAA
Copy link
Collaborator Author

To follow up regarding the module variable documentation, do use inline comments where the variables are declared, and not with a @param tag in the doxygen header. That's my error in the Reference. I'll make a PR to correct that. Below I copy/pasted a comment from a closed PR in which @edwardhartnett shows this:


The !< marker can be used when var documentation is short enough to fit on one line, but is not mandatory. Just as with other doxygen documentation blocks, the !> marker can be used, and the documentation placed before the variable.

It should be noted that all module and type variables need documentation. That is, each variable must be documented, none skipped (or you will get warnings).

Here's an example using the !< marker, where each element of documentation fits on one line:

module ip_grid_mod
  use ip_grid_descriptor_mod
  implicit none

  integer, public, parameter :: EQUID_CYLIND_GRID_ID_GRIB1 = 0 !< Integer grid number for equidistant cylindrical grid in grib1
  integer, public, parameter :: MERCATOR_GRID_ID_GRIB1 = 1 !< Integer grid number for Mercator grid in grib1
  integer, public, parameter :: LAMBERT_CONF_GRID_ID_GRIB1 = 3 !< Integer grid number for Lambert Conformal grid in grib1
  integer, public, parameter :: GAUSSIAN_GRID_ID_GRIB1 = 4 !< Integer grid number for Gaussian grid in grib1
  integer, public, parameter :: POLAR_STEREO_GRID_ID_GRIB1 = 5 !< Integer grid number for polar stereo grid in grib1
  integer, public, parameter :: ROT_EQUID_CYLIND_E_GRID_ID_GRIB1 = 203 !< Integer grid number for rotated equidistant cylindrical E-stagger grid
  integer, public, parameter :: ROT_EQUID_CYLIND_B_GRID_ID_GRIB1 = 205 !< Integer grid number for rotated equidistant cylindrical B-stagger grid

  integer, public, parameter :: EQUID_CYLIND_GRID_ID_GRIB2 = 0 !< Integer grid number for equidistant cylindrical grid in grib2
  integer, public, parameter :: ROT_EQUID_CYLIND_GRID_ID_GRIB2 = 1 !< Integer grid number for rotated equidistant cylindrical grid in grib2
  integer, public, parameter :: MERCATOR_GRID_ID_GRIB2 = 10 !< Integer grid number for Mercator grid in grib2
  integer, public, parameter :: POLAR_STEREO_GRID_ID_GRIB2 = 20 !< Integer grid number for polar stereo grid in grib2
  integer, public, parameter :: LAMBERT_CONF_GRID_ID_GRIB2 = 30 !< Integer grid number for Lambert conformal grid in grib2
  integer, public, parameter :: GAUSSIAN_GRID_ID_GRIB2 = 40 !< Integer grid number for Gaussian grid in grib2

Here's an example where more detail is required, and the documentation elements usually come before the variables:

  type gribfield
     integer :: version        !< GRIB edition number (currently 2).

     !>     Message Discipline (see [Code Table 0.0]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table0-0.shtml)).
     integer :: discipline

     !>    Contains the entries in the Identification Section (Section
     !>    1).
     !>    - idsect(1) Identification of originating Centre
     !>    (see Common Code Table C-1) 7 US National Weather Service. ([Table 0]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/on388/table0.html)).
     !>    - idsect(2) Identification of originating Sub-centre ([Table C]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/on388/tablec.html)).
     !>    - idsect(3) GRIB Master Tables Version Number. ([Table 1.0]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-0.shtml))
     !>    0 Experimental; 1 Initial operational version number
     !>    - idsect(4) GRIB Local Tables Version Number ([Table 1.1]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-1.shtml)).
     !>     - 0 Local tables not used
     !>     - 0 1-254 Number of local tables version used
     !>    - idsect(5) Significance of Reference Time ([Table 1.2]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-1.shtml)).
     !>     - 0 Analysis
     !>     - 1 Start of forecast
     !>     - 2 Verifying time of forecast
     !>     - 3 Observation time
     !>    - idsect(6) Year (4 digits)
     !>    - idsect(7) Month
     !>    - idsect(8) Day
     !>    - idsect(9) Hour
     !>    - idsect(10) Minute
     !>    - idsect(11) Second
     !>    - idsect(12) Production status of processed data (see [Table 1.3]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-3.shtml))
     !>     - 0 Operational products
     !>     - 1 Operational test products
     !>     - 2 Research products
     !>     - 3 Re-analysis products
     !>    - idsect(13) Type of processed data ([Table 1.4]
     !>    (https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-4.shtml))
     !>     - 0 Analysis products
     !>     - 1 Forecast products
     !>     - 2 Analysis and forecast products
     !>     - 3 Control forecast products
     !>     - 4 Perturbed forecast products
     !>     - 5 Control and perturbed forecast products
     !>     - 6 Processed satellite observations
     !>     - 7 Processed radar observations
     integer, pointer, dimension(:) :: idsect => null()

     !>    Number of elements in idsect (always 13).
     integer :: idsectlen

     !>    Pointer to character array containing contents
     !>    of Local Section 2, if included.
     character(len = 1), pointer, dimension(:) :: local => null()

     !>    Length of array local.
     integer :: locallen

@ukmo-ccbunney
Copy link
Collaborator

@MatthewMasarik-NOAA - Okey-dokey.
This is just for the module variables, yes? The subroutines and functions still use @param?

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Yes, exactly correct.

@edwardhartnett
Copy link
Contributor

In general the doxygen version is significant. 1.8.5 is very old and should be upgraded.

The reason includes the fact that the Doxyfile changes from version to version - new items are added, and some are taken away. We rely on several settings that are in more recent doxygen versions, including WARN_AS_ERROR.

When we set up the doxygen build in the CI, it will be using the doxygen release associated with "ubuntu-latest" which, currently, is 1.8.17. Everyone using doxygen on their own machine should upgrade to 1.8.17. Do not upgrade to 1.9.x, because that is not what will be used in the CI. So 1.8.17 is the canonical version of doxygen at the moment.

In general, close versions of doxygen usually work, though sometimes with extra warnings. But the doxygen build must target a specific version, which is currently 1.8.17.

On NCEPLIBS we converted all old logs to tables in the doxygen, for example:

!> ### Program History Log
!> Date | Programmer | Comments
!> -----|------------|---------
!> 2000-05-09 | Stephen Gilbert | Initial development
!> 2003-09-02 | Stephen Gilbert | Added GDT 3.31 Albers Equal Area
!> 2007-04-24 | Boi Vuong | Added GDT 3.204 Curilinear Orthogonal Grids
!> 2008-05-29 | Boi Vuong | Added GDT 3.32768 Rotate Lat/Lon E-grid
!> 2010-05-10 | Boi Vuong | Added GDT 3.32769 Rotate Lat/Lon Non E-Stagger grid
!> 2013-08-06 | Boi Vuong | Added GDT 3.4,3.5,3.12,3.101,3.140

This yields an attractive output, and is compact in the code.

In NCEPLIBS we took out all other headers and documentation blocks, and this is the common practice with doxygen projects. The goal is to have only what is needed, and, as was mentioned above, having some boilerplate headers at the top of every file is not useful. (We also have our legal disclaimer at the bottom of every README.md file.)

If there is a desire to have some repeated text appear everywhere, that can be done in doxygen, as a page header or footer, or in some other ways. Doxygen also has special handling for copyright information, should you wish to use it. (That is, you can define a copyright block and include it wherever you like).

In general, the text you want to repeat in the output documentation does not have to be repeated in the code everywhere.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Hey all, if you have completed files to add, you can commit them to the draft PR I just opened: #600 .

@ukmo-ccbunney
Copy link
Collaborator

@edwardhartnett I like the change history table idea. I will use that for the top level change log in the module. However, we have change logs on each individual function/subroutine too. I think this is a bit over the top in the documentation, so I won't elevate those to doxygen comments.

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Jan 27, 2022

Hey all, if you have completed files to add, you can commit them to the draft PR I just opened: #600 .

@MatthewMasarik-NOAA I don't have write access to your branch, so can't add my changes. I've got some files ready to go in my https://github.com/ukmo-waves/WW3/tree/doc/ounfmeta branch; shall I raise my own PR for them?

I would like your (or @edwardhartnett 's) input on one issue I have had though (for which I have a workaround that doesn't make sense to me!) See the comment here:
https://github.com/ukmo-waves/WW3/blob/d130d7170872c5798d1d779b63a1a216a48f139d/model/src/w3ounfmetamd.F90#L164-L168

@edwardhartnett
Copy link
Contributor

Since this branch does not seem to have the CMake build, how do you build the docs?

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Jan 28, 2022

I run doxygen docs/Doxyfile.in from the WW3 root directory.
Is that wrong? 😬

Edit: This is branched from develop - not the cmake branch.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

MatthewMasarik-NOAA commented Jan 31, 2022

Hi @ukmo-ccbunney , I'm back from being away last week. I'm going to take quick look at your branch to see if something sticks out.. Do you have files to add to the PR I made?

Update: I'll pull in your doc/ounfmeta branch.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

@ukmo-ccbunney I found how to fix the state: 22(String) error you we're getting. It wasn't anything you we're doing wrong, it was a setting in Doxygen.in for the EXTENSION_MAPPING. The default is empty. Here's the comment block with the Fortran specific entries added:

# Doxygen selects the parser to use depending on the extension of the files it 
# parses. With this tag you can assign which parser to use for a given 
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, 
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, 
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:  
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser 
# tries to guess whether the code is fixed or free formatted code, this is the 
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat 
# .inc files as Fortran files (default is PHP), and .f files as C (default is  
# Fortran), use: inc=Fortran f=C.                              
#                                             
# Note: For files without extension you can use no_extension as a placeholder.  
#                                                        
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise   
# the files are not read by doxygen.     
                                  
EXTENSION_MAPPING      = f=FortranFixed f90=FortranFree F90=FortranFree         
  

I'll PR this change.

@edwardhartnett
Copy link
Contributor

@MatthewMasarik-NOAA I am so glad you found that, I was totally on the wrong track with this one! ;-)

And I should have remembered this because it came up in another project. by default *.f90 is accepted as free-format Fortran, but not *.F90!

@ukmo-ccbunney
Copy link
Collaborator

Hi @ukmo-ccbunney , I'm back from being away last week. I'm going to take quick look at your branch to see if something sticks out.. Do you have files to add to the PR I made?

Update: I'll pull in your doc/ounfmeta branch.

Thanks @MatthewMasarik-NOAA I've just pushed one small change to remove the comment line from w3ounfmetamd.F90.

BTW - I tried to raise a PR to target your branch, but your WW3 repo doesn't appear in the list of available target forks...which is odd. If you're happy to pull in my changes, then that's great.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

BTW - I tried to raise a PR to target your branch, but your WW3 repo doesn't appear in the list of available target forks...which is odd. If you're happy to pull in my changes, then that's great.

@ukmo-ccbunney It is odd, I'm working to get that rectified. I'll let you know it's fixed, in the time being I'm happy to pull in your changes.

@ukmo-ccbunney
Copy link
Collaborator

@MatthewMasarik-NOAA
I'm happy to update w3partmd, w3psmcmd and w3smcomd if you want to put my name against those (I can't edit the original PR description)

@MatthewMasarik-NOAA
Copy link
Collaborator Author

@ukmo-ccbunney that would be great. I just added you as a collaborator to the repo. See if that solved the issue... if not, I'll put you down for those files.

@ukmo-ccbunney
Copy link
Collaborator

@ukmo-ccbunney that would be great. I just added you as a collaborator to the repo. See if that solved the issue... if not, I'll put you down for those files.

I can't edit your PR description, but I can now raise a PR against your repo (although I have not done so yet), so it does fix that issue. If you can update the description with my name against those files I will raise a PR when I am done. Thanks!

@MatthewMasarik-NOAA
Copy link
Collaborator Author

I can't edit your PR description, but I can now raise a PR against your repo (although I have not done so yet), so it does fix that issue.

Okay, that is good news you can raise a PR now.

If you can update the description with my name against those files I will raise a PR when I am done. Thanks!

sure thing! I've got those assigned to you.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Hi @aronroland @MathieuDutSik, do either of you have interest in adding doxygen documentation to the .F90 files in PDLIB? I see there is already some snippets added. It would be really great to have the original authors who are most familiar with the code to be involved. No pressure though, I wanted to offer to you first since you wrote it. Thanks

@aronroland
Copy link
Collaborator

Hi Mathew, yes definitely this must be done, we started it long time ago but it was laid down. I will do that asap. Thanks for looking at this!

@MatthewMasarik-NOAA
Copy link
Collaborator Author

Hi Aron, that's great news! Thank you.

@MatthewMasarik-NOAA
Copy link
Collaborator Author

💯

@edwardhartnett
Copy link
Contributor

@MatthewMasarik-NOAA and I discussed this doxygenation effort as part of the larger EMC documentation effort.

Excellent documentation is a requirement for all EMC science codes. Good documentation speeds development, prevents bugs, and greatly assists testing efforts, especially when tests are being written by those who did not originate the code. Good documentation is all that stands between a programmer and the misuse of his or her code, causing an expensive or embarrassing problem which could easily have been avoided.

We have upgraded the documentation to doxygen, with high standards, on all the NCEPLIBS, UFS_UTILS, UPP, and soon fv3atm. It's great to see it happening on WW3 and we are ready to help out, as we did with the other projects.

The ultimate goal, which takes effort, but is well worth it, is to turn on doxygen checking in the CI system.

Currently, for NCEPLIBS or UFS_UTILS, if a contributor submits a PR with undocumented code, it will fail CI. This provides immediate feedback to the programmer and allows them to resolve the problem cheaply and immediately. They can submit a PR at 3 am, notice it failed, and have the documentation updated by 3:15 am. All without involving Matt or any other team member.

This is how other science software projects maintain excellent documentation with very few programmers. We automate as much as we can, to save team time to work on important programming problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants