Unverified Commit f41237c3 authored by Ross Beyer's avatar Ross Beyer Committed by GitHub
Browse files

zenodo and authors: Upgraded handling of the authors information. (#4024)

* docs(zenodo and authors): Upgraded handling of the authors information.

- Upgraded zenodo_to_authors.py to write out the AUTHORS.rst file in
  alphabetical order, and added affiliations, if any.
- Created zenodo_order.py to re-arrange the "creator" list in the
  .zenodo.json file so that it is designated first author (project lead)
  followed by everyone else in alphabetical order.
- Committed the new versions of .zenodo.json and AUTHORS.rst
- Added my own name, affiliation, and ORCID iD

* feat(zenodo_order.py): Made the first author designation a command line
argument with a default, and altered some of the algorithm.
parent 02713c43
Loading
Loading
Loading
Loading
+73 −70
Original line number Diff line number Diff line
@@ -6,192 +6,195 @@
      "orcid": ""
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Mapel, Jesse"
      "name": "Addair, Travis"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Berry, Kristin"
      "name": "Adoram-Kershner, Lauren"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Lee, Kaitlyn"
      "name": "Alexandrov, Oleg"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Rodriguez, Kelvin"
      "name": "Anderson, Jeff"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Sides, Stuart",
      "orcid": ""
      "name": "Annex, Andrew"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Paquette, Adam"
      "name": "Austin, Christopher"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Williams, Kaj"
      "name": "Backer, Jeanie"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Sanders, Austin"
      "name": "Barrett, Janet"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Adoram-Kershner, Lauren"
      "name": "Becker, Kris"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Shinaman, John"
      "name": "Berry, Kristin"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Weller, Lynn"
      "name": "Beyer, Ross",
      "affiliation": "SETI Institute and NASA Ames Research Center",
      "orcid": "0000-0003-4503-3335"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Dunn, Evin"
      "name": "Bonn, John"
    },
    {
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Giroux, Tim"
      "name": "Boyd, Mackenzie"
    },
    {
      "name": "Sucharski, Tracie"
      "name": "Brownsberger, Sasha"
    },
    { "name": "Backer, Jeanie"
    {
      "name": "Combs, Christopher"
    },
    {
      "name": "Goins, Adam"
      "name": "Cook, Debbie"
    },
    {
      "name": "Shepard, Makayla"
      "name": "Covington, Jeffrey"
    },
    {
      "name": "Combs, Christopher"
      "name": "Crough, James Alexander"
    },
    {
      "name": "Cook, Debbie"
      "name": "Curtis, Aaron"
    },
    {
      "name": "Becker, Kris"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Dunn, Evin"
    },
    {
      "name": "Stapleton, Summer"
      "name": "Edmundson, Kenneth"
    },
    {
      "name": "Neubauer, Cole"
      "name": "Eis, Mathew"
    },
    {
      "name": "Wilson, Tyler"
      "name": "Gault, Eric"
    },
    {
      "name": "Giroux, Aaron"
    },
    {
      "name": "Milazzo, Moses"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Giroux, Tim"
    },
    {
      "name": "Beyer, Ross"
      "name": "Goins, Adam"
    },
    {
      "name": "Howington-Kraus, Elpitha"
      "name": "Hahn, Marjorie"
    },
    {
      "name": "Edmundson, Kenneth"
      "name": "Heyer, Eric"
    },
    {
      "name": "Saleh, Raad"
      "name": "Howington-Kraus, Elpitha"
    },
    {
      "name": "Alexandrov, Oleg"
      "name": "Humphrey, Ian"
    },
    {
      "name": "Curtis, Aaron"
      "name": "Lambright, Steven"
    },
    {
      "name": "Gault, Eric"
      "name": "Lee, Ella Mae"
    },
    {
      "name": "Annex, Andrew"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Lee, Kaitlyn"
    },
    {
      "name": "Silva, Victor"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Mapel, Jesse"
    },
    {
      "name": "Seignovert, Benoit"
      "name": "Milazzo, Moses"
    },
    {
      "name": "Stebenne, Andrew"
      "name": "Miller, David"
    },
    {
      "name": "Austin, Christopher"
      "name": "Neubauer, Cole"
    },
    {
      "name": "Rose, Curtis"
      "name": "Oyama, Kim"
    },
    {
      "name": "Miller, David"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Paquette, Adam"
    },
    {
      "name": "Lee, Ella Mae"
      "name": "Prasad, Sharmilla"
    },
    {
      "name": "Heyer, Eric"
      "name": "Rideout, Jai"
    },
    {
      "name": "Humphrey, Ian"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Rodriguez, Kelvin"
    },
    {
      "name": "Rideout, Jai"
      "name": "Rose, Curtis"
    },
    {
      "name": "Crough, James Alexander"
      "name": "Saleh, Raad"
    },
    {
      "name": "Barrett, Janet"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Sanders, Austin"
    },
    {
      "name": "Anderson, Jeff"
      "name": "Seignovert, Benoit"
    },
    {
      "name": "Covington, Jeffrey"
      "name": "Shepard, Makayla"
    },
    {
      "name": "Bonn, John"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Shinaman, John"
    },
    {
      "name": "Oyama, Kim"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Sides, Stuart",
      "orcid": ""
    },
    {
      "name": "Boyd, Mackenzie"
      "name": "Silva, Victor"
    },
    {
      "name": "Hahn, Marjorie"
      "name": "Stapleton, Summer"
    },
    {
      "name": "Eis, Mathew"
      "name": "Stebenne, Andrew"
    },
    {
      "name": "Thomas, Orrin"
      "name": "Sucharski, Tracie"
    },
    {
      "name": "Brownsberger, Sasha"
      "name": "Thomas, Orrin"
    },
    {
      "name": "Prasad, Sharmilla"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Weller, Lynn"
    },
    {
      "name": "Lambright, Steven"
      "affiliation": "United States Geological Survey, Astro Geology Science Center",
      "name": "Williams, Kaj"
    },
    {
      "name": "Addair, Travis"
      "name": "Wilson, Tyler"
    }
  ],
  "title": "Integrated Software for Imageers and Spectrometers",
  "description": "A software library and set of tools to support ingestions, processing, and analysis of planetary science data.",
  "title": "Integrated Software for Imagers and Spectrometers",
  "description": "A software library and set of tools to support ingestion, processing, and analysis of planetary science data.",
  "license": "cc-zero",
  "access_right": "open",
  "upload_type": "software"
+76 −61
Original line number Diff line number Diff line
ISIS3 Contributors
==================
Integrated Software for Imagers and Spectrometers Contributors
==============================================================

- Jason Laura
- Jesse Mapel
- Kristin Berry
- Kaitlyn Lee
- Kelvin Rodriguez
- Stuart Sides
- Adam Paquette
- Kaj Williams
- Austin Sanders
- Lauren Adoram-Kershner
- John Shinaman
- Lynn Weller
- Evin Dunn
- Tim Giroux
- Tracie Sucharski
- Jeanie Backer
- Adam Goins
- Makayla Shepard
- Christopher Combs
- Debbie Cook
- Kris Becker
- Summer Stapleton
- Cole Neubauer
- Tyler Wilson
- Aaron Giroux
- Moses Milazzo
- Ross Beyer
- Elpitha Howington-Kraus
- Kenneth Edmundson
- Raad Saleh
- Oleg Alexandrov
- Aaron Curtis
- Eric Gault
- Andrew Annex
- Victor Silva
- Benoit Seignovert
- Andrew Stebenne
- Christopher Austin
- Curtis Rose
- David Miller
- Ella Mae Lee
- Eric Heyer
- Ian Humphrey
- Jai Rideout
- James Alexander Crough
- Janet Barrett
- Jeff Anderson
- Jeffrey Covington
- John Bonn
- Kim Oyama
- Mackenzie Boyd
- Marjorie Hahn
- Mathew Eis
- Orrin Thomas
- Sasha Brownsberger
- Sharmilla Prasad
- Steven Lambright
- Travis Addair
- Addair, Travis
- Adoram-Kershner, Lauren (United States Geological Survey, Astro
  Geology Science Center)
- Alexandrov, Oleg
- Anderson, Jeff
- Annex, Andrew
- Austin, Christopher
- Backer, Jeanie
- Barrett, Janet
- Becker, Kris
- Berry, Kristin (United States Geological Survey, Astro Geology
  Science Center)
- Beyer, Ross (SETI Institute and NASA Ames Research Center)
- Bonn, John
- Boyd, Mackenzie
- Brownsberger, Sasha
- Combs, Christopher
- Cook, Debbie
- Covington, Jeffrey
- Crough, James Alexander
- Curtis, Aaron
- Dunn, Evin (United States Geological Survey, Astro Geology Science
  Center)
- Edmundson, Kenneth
- Eis, Mathew
- Gault, Eric
- Giroux, Aaron
- Giroux, Tim (United States Geological Survey, Astro Geology Science
  Center)
- Goins, Adam
- Hahn, Marjorie
- Heyer, Eric
- Howington-Kraus, Elpitha
- Humphrey, Ian
- Lambright, Steven
- Laura, Jason (United States Geological Survey, Astro Geology Science
  Center)
- Lee, Ella Mae
- Lee, Kaitlyn (United States Geological Survey, Astro Geology Science
  Center)
- Mapel, Jesse (United States Geological Survey, Astro Geology Science
  Center)
- Milazzo, Moses
- Miller, David
- Neubauer, Cole
- Oyama, Kim
- Paquette, Adam (United States Geological Survey, Astro Geology
  Science Center)
- Prasad, Sharmilla
- Rideout, Jai
- Rodriguez, Kelvin (United States Geological Survey, Astro Geology
  Science Center)
- Rose, Curtis
- Saleh, Raad
- Sanders, Austin (United States Geological Survey, Astro Geology
  Science Center)
- Seignovert, Benoit
- Shepard, Makayla
- Shinaman, John (United States Geological Survey, Astro Geology
  Science Center)
- Sides, Stuart (United States Geological Survey, Astro Geology
  Science Center)
- Silva, Victor
- Stapleton, Summer
- Stebenne, Andrew
- Sucharski, Tracie
- Thomas, Orrin
- Weller, Lynn (United States Geological Survey, Astro Geology Science
  Center)
- Williams, Kaj (United States Geological Survey, Astro Geology
  Science Center)
- Wilson, Tyler

-----
This list was generated from the .zenodo.json file by running python zenodo_to_authors.py.
 No newline at end of file
This list was generated from the .zenodo.json file by running the
isis/scripts/zenodo_to_authors.py Python program.
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ update the Unreleased link so that it compares against the latest release tag.
 
 - A Gui Helper gear was added to hist to fill in the minimum and maximum parameters with what would have been automatically calculated. [#3880](https://github.com/USGS-Astrogeology/ISIS3/issues/3880) 

- Added some Python programs (in isis/scripts/) to manage the authoritative .zenodo.json file
  which contains the ISIS authors, and to generate the AUTHORS.rst file from it.


## [4.2.0] - 2020-07-27

### Added
+83 −0
Original line number Diff line number Diff line
#!/usr/bin/env python
"""
This program reads the .zenodo.json file finds the
designated first author, puts them first, and then puts the
remainder in alphabetical order.
"""

import argparse
import json
import sys

from operator import itemgetter

# This is free and unencumbered software released into the public domain.
#
# The authors of ISIS do not claim copyright on the contents of this file.
# For more details about the LICENSE terms and the AUTHORS, you will
# find files of those names at the top level of this repository.
#
# SPDX-License-Identifier: CC0-1.0

parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
    "-f",
    "--first_author",
    required=False,
    default="Laura, Jason",
    help="Must correspond to a name entry in the zenodo_json file being read, "
    "will place this creator first. Normally defaults to the ISIS project "
    "lead (default: %(default)s) ."
)
parser.add_argument(
    "zenodo_json",
    type=str,
    help="The file path to the .zenodo.json file to read."
)
parser.add_argument(
    "json_out",
    type=str,
    help="The path to the output .json file to write."
)

args = parser.parse_args()

# Read .zenodo.json file:
try:
    with open(args.zenodo_json, 'r') as zenodo_file:
        parsed_json = json.load(zenodo_file)
except OSError as err:
    sys.exit(f"Could not open {args.zenodo_json} for reading: {err}")
except json.JSONDecodeError as err:
    sys.exit(f"Could not correctly parse JSON from {args.zenodo_json}: {err}")

# Find and extract the project lead
creators_list = parsed_json["creators"]

new_creators = list()
first = None

for creator in parsed_json["creators"]:
    if creator["name"] == args.first_author:
        first = creator
    else:
        new_creators.append(creator)

if first is None:
        sys.exit(
            f"The designated first author ({args.first_author}) was not found "
            f"in {args.zenodo_json}"
        )

new_creators.sort(key=itemgetter("name"))
new_creators.insert(0, first)

# Replace
parsed_json["creators"] = new_creators

# Write out new json file
try:
    with open(args.json_out, 'w') as f:
        json.dump(parsed_json, f, indent=2)
except OSError as err:
    sys.exit(f"Could not write out {args.json_out}: {err}")
+59 −26
Original line number Diff line number Diff line
# Uses a .zenodo.json file to generate an AUTHORS.rst file. 
#!/usr/bin/env python
"""
This program builds reads a .zenodo.json file and generates a more readable
reStructuredText file, suitable for AUTHORS.rst.
"""

import os
import argparse
import json
import textwrap
import sys

parser = argparse.ArgumentParser(description="Generate an AUTHORS.rst file from a .zenodo.json file")
parser.add_argument("zenodo_input_file", type=str, help="The file path to the .zenodo.json file.")
parser.add_argument("authors_output_file", type=str, help="The path for the output AUTHORS.rst file.")
from operator import itemgetter

args = parser.parse_args()
# This is free and unencumbered software released into the public domain.
#
# The authors of ISIS do not claim copyright on the contents of this file.
# For more details about the LICENSE terms and the AUTHORS, you will
# find files of those names at the top level of this repository.
#
# SPDX-License-Identifier: CC0-1.0

parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
    "zenodo_json",
    type=str,
    help="The file path to the .zenodo.json file."
)
parser.add_argument(
    "authors_rst",
    type=str,
    help="The path for the output AUTHORS.rst file."
)

zenodo_path = args.zenodo_input_file
authors_path = args.authors_output_file
args = parser.parse_args()

# Read .zenodo.json file:
try:
  with open(zenodo_path, 'r') as zenodo_file:
    with open(args.zenodo_json, 'r') as zenodo_file:
        parsed_json = json.load(zenodo_file)
except: 
  print("{} could not be read as the input file.".format(zenodo_path))
  raise
except OSError as err:
    sys.exit(f"Could not open {args.zenodo_json} for reading: {err}")
except json.JSONDecodeError as err:
    sys.exit(f"Could not correctly parse JSON from {args.zenodo_json}: {err}")

output_lines = ["ISIS3 Contributors", "==================\n"]
output_lines = [
    """\
Integrated Software for Imagers and Spectrometers Contributors
==============================================================
"""
]

for author in sorted(parsed_json['creators'], key=itemgetter('name')):
    # family, given = author['name'].split(",")
    # line = f"- {given.strip()} {family.strip()}"
    line = author['name'].strip()
    if "affiliation" in author:
        line += f" ({author['affiliation'].strip()})"
    output_lines.extend(textwrap.wrap(
        line, initial_indent="- ", subsequent_indent="  "
    ))

for elt in parsed_json['creators']:
  name = elt['name']
  last, first = name.split(",")
  output_lines.append("- {} {}".format(first.strip(),last.strip()))

output_lines.append("\n-----")
output_lines.append("This list was generated from the .zenodo.json file by running python zenodo_to_authors.py.")
output_lines.extend(textwrap.wrap(
    "This list was generated from the .zenodo.json file by running the "
    "isis/scripts/zenodo_to_authors.py Python program."
))

# Write to AUTHORS.rst file
try:
  with open(authors_path, 'w') as authors_file:
    with open(args.authors_rst, 'w') as authors_file:
        authors_file.write('\n'.join(output_lines))
except:
  print("{} could not be opened as the output file.".format(authors_path))
  raise
except OSError as err:
    sys.exit(f"Could not write out {args.authors_rst}: {err}")