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

separate options parsing for byteTrace and visitTrace functions #226

Merged

Conversation

alexzurbonsen
Copy link
Contributor

@alexzurbonsen alexzurbonsen commented Sep 7, 2024

Triage

Type of change

Please select any of the below items that are appropriate.

This pull request:

  • Adds a new carbon estimation model to CO2.js
  • Adds new functionality to an existing model
  • Fixes a bug with an existing model implementation
  • Add other new functionality to CO2.js
  • Add new data to CO2.js
  • Improves developer experience for contributors
  • Adds contributors to CO2.js
  • Does something not specified above

Related issue/s

Please list below any issues this pull request is related to.

Docs changes required

Do any changes made in this pull request require parts of the CO2.js documentation to be updated?

  • Yes
  • No
  • I don't know

If you answered "Yes", please create an corresponding issue in our Developer Documentation repository.

Describe the changes made in this pull request

Context: see #244

Summary:
This PR splits options parsing into two separate functions, one for the perByteTrace function and one for the perVisitTrace function such that only the options relevant to the function are parsed.

Alternatives: considered: introduce a flag parameter in the existing function to return early when the function is called from perByteTrace. To me this seems less clear, but it would be less invasive.
Also one could create another parsing function for the additional visit options, but not sure that is desirable.

@alexzurbonsen alexzurbonsen force-pushed the separate-options-parsing branch from 8692e57 to 52a265d Compare September 7, 2024 13:45
@alexzurbonsen
Copy link
Contributor Author

I have made the change, but I cannot install the project locally. There is a build failure in one of the dependencies that I do not have the time to figure out. Let's see what the ci says.

@alexzurbonsen alexzurbonsen force-pushed the separate-options-parsing branch from 52a265d to db3a561 Compare September 7, 2024 13:49
@alexzurbonsen
Copy link
Contributor Author

I didn't understand yet, why the unit tests are failing. The computed values are always a bit off. Not sure if I made a mistake in the option parsing or if some other inputs evolved. but not sure why that should affect versioned older builds.

@alexzurbonsen alexzurbonsen force-pushed the separate-options-parsing branch from db3a561 to 737010a Compare September 8, 2024 19:51
Signed-off-by: alexzurbonsen <alexander.zur.bonsen@tngtech.com>
@alexzurbonsen alexzurbonsen force-pushed the separate-options-parsing branch from 737010a to 3d4fec7 Compare September 8, 2024 20:01
commit 38b7849
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:49:38 2024 +0800

    update iife

commit 473454b
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:44:08 2024 +0800

    0.16.3

commit e85b674
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:43:29 2024 +0800

    update contributors

commit 6041435
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:43:18 2024 +0800

    update contributors

commit 20c879d
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:37:45 2024 +0800

    update contributors

commit 432bc0e
Merge: 431492d e58125e
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:32:10 2024 +0800

    Include all gridIntensity values in adjustments when only some are overridden

commit e58125e
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Sat Nov 30 16:21:44 2024 +0800

    Squashed commit of the following:

    commit 431492d
    Author: samuelIkoli <ayibanimiikoli@gmail.com>
    Date:   Thu Nov 14 11:18:57 2024 +0100

        spelling typo corrected

    commit d4731ba
    Author: Chris Adams <chris@productscience.co.uk>
    Date:   Fri Nov 15 07:45:38 2024 +0000

        Update changelog to include new PR

    commit 4146166
    Author: Chris Adams <chris@productscience.co.uk>
    Date:   Fri Nov 15 07:40:58 2024 +0000

        Update supported versions of nodejs in tests

    commit 32047da
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Nov 12 12:23:08 2024 +0800

        update contributors

    commit 13bb452
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Nov 12 12:20:21 2024 +0800

        update to 0.16.2

    commit 95c2d00
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Nov 12 12:17:28 2024 +0800

        0.16.2

    commit 5680b23
    Merge: 81633d7 978a92d
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Nov 12 11:52:33 2024 +0800

        Bump url2green version

    commit 978a92d
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Nov 12 11:51:31 2024 +0800

        bump url2green 0.4.1

    commit 8eb0630
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Thu Oct 24 12:56:34 2024 +0800

        update iife

commit 431492d
Author: samuelIkoli <ayibanimiikoli@gmail.com>
Date:   Thu Nov 14 11:18:57 2024 +0100

    spelling typo corrected

commit d4731ba
Author: Chris Adams <chris@productscience.co.uk>
Date:   Fri Nov 15 07:45:38 2024 +0000

    Update changelog to include new PR

commit 4146166
Author: Chris Adams <chris@productscience.co.uk>
Date:   Fri Nov 15 07:40:58 2024 +0000

    Update supported versions of nodejs in tests

commit 32047da
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Nov 12 12:23:08 2024 +0800

    update contributors

commit 13bb452
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Nov 12 12:20:21 2024 +0800

    update to 0.16.2

commit 95c2d00
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Nov 12 12:17:28 2024 +0800

    0.16.2

commit 5680b23
Merge: 81633d7 978a92d
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Nov 12 11:52:33 2024 +0800

    Bump url2green version

commit 978a92d
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Nov 12 11:51:31 2024 +0800

    bump url2green 0.4.1

commit afea798
Author: Ash Johns <mail@ashpjohns.com>
Date:   Thu Nov 7 15:39:36 2024 -0500

    address linter errors

commit 4c1b8cb
Author: Ash Johns <mail@ashpjohns.com>
Date:   Thu Nov 7 15:28:48 2024 -0500

    reduce repeated code and ensure default gridIntensity is returned

commit 8eb0630
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Thu Oct 24 12:56:34 2024 +0800

    update iife

commit 81633d7
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 17:06:52 2024 +0800

    update test constants

commit cd94a29
Merge: e6847e5 9202d20
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 11:06:11 2024 +0200

    [AUTOMATED] Update average annual grid intensities

commit 9202d20
Merge: a44f105 e6847e5
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 10:59:19 2024 +0200

    Merge branch 'main' into average-intensities/11160031721

commit a44f105
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:58:25 2024 +0800

    update grid average grid intensity data

commit 3e3fc3e
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:56:52 2024 +0800

    Merged updates to generator scripts from main.

commit e6847e5
Merge: 668d8e4 7891414
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 10:52:10 2024 +0200

    Added basic error handling to data fetch in emissions script

commit 7891414
Merge: e535f1b 668d8e4
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 10:50:18 2024 +0200

    Merge branch 'main' into feature/add-error-handling

commit e535f1b
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:41:14 2024 +0800

    Squashed commit of the following:

    commit 668d8e4
    Merge: 33c66d7 21a1a25
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Oct 23 10:15:46 2024 +0200

        Add JSDoc comments to data generation scripts and output files

    commit 21a1a25
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Oct 23 16:11:01 2024 +0800

        add comments to output of generators

    commit cab18cf
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Oct 23 16:05:24 2024 +0800

        add comments about constants in source files

    commit 33c66d7
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Mon Oct 14 15:46:00 2024 +0800

        add note about commenting

    commit 5e58971
    Author: Malay Kumar <malaykumar2003@gmail.com>
    Date:   Sat Oct 12 19:01:39 2024 +0530

        Add JsDoc comments to marginal-intensities-2021

    commit 6b000a0
    Author: Malay Kumar <malaykumar2003@gmail.com>
    Date:   Sat Oct 12 19:01:19 2024 +0530

        Add JsDoc comments to average-intensities

    commit 29b6755
    Author: Malay Kumar <malaykumar2003@gmail.com>
    Date:   Sat Oct 12 18:59:08 2024 +0530

        Add JsDoc comments to generate_marginal_co2

    commit eb4e9ff
    Author: Malay Kumar <malaykumar2003@gmail.com>
    Date:   Sat Oct 12 18:58:53 2024 +0530

        Add JsDoc comments to generate_average_co2

    commit c238d96
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Sep 11 10:30:41 2024 +0800

        v0.16.1

    commit d5d3156
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:44:34 2024 +0800

        0.16.1

    commit 4b10930
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:43:51 2024 +0800

        v0.16.1

    commit 8339284
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:38:33 2024 +0800

        update jsr export

    commit 6c0f991
    Merge: 8f9097c ed2d8ab
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:35:05 2024 +0800

        Add basic JSR support

    commit ed2d8ab
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:20:27 2024 +0800

        update average grid intensities

    commit 8f9097c
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:17:29 2024 +0800

        update test constants

    commit ce1ada5
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:11:41 2024 +0800

        update version

    commit 2962ca1
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:06:52 2024 +0800

        create hosting module

    commit 2dd34ec
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Tue Sep 10 15:03:33 2024 +0800

        add mod.ts for jsr

    commit 870e621
    Merge: 7adac52 87d0e62
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Fri Sep 6 14:35:09 2024 +0800

        [AUTOMATED] Update average annual grid intensities

    commit 87d0e62
    Author: fershad <fershad@users.noreply.github.com>
    Date:   Tue Sep 3 10:10:55 2024 +0000

        Update average annual grid intensities

    commit 7adac52
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Aug 21 12:55:39 2024 +0800

        update test constant

    commit 344a513
    Merge: 4541319 d080a36
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Aug 14 21:36:04 2024 +0200

        [AUTOMATED] Update average annual grid intensities

    commit d080a36
    Author: fershad <fershad@users.noreply.github.com>
    Date:   Sat Aug 3 10:09:23 2024 +0000

        Update average annual grid intensities

    commit 4541319
    Merge: 8f95399 c19da59
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Wed Jul 31 22:38:58 2024 +0200

        Export classes inside of the individual models

    commit c19da59
    Author: fershad <27988517+fershad@users.noreply.github.com>
    Date:   Thu Jul 11 22:02:57 2024 +0100

        export classes inside of the CO2 class

commit 668d8e4
Merge: 33c66d7 21a1a25
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 10:15:46 2024 +0200

    Add JSDoc comments to data generation scripts and output files

commit 21a1a25
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:11:01 2024 +0800

    add comments to output of generators

commit cab18cf
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:05:24 2024 +0800

    add comments about constants in source files

commit 33c66d7
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Mon Oct 14 15:46:00 2024 +0800

    add note about commenting

commit 5e58971
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 19:01:39 2024 +0530

    Add JsDoc comments to marginal-intensities-2021

commit 6b000a0
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 19:01:19 2024 +0530

    Add JsDoc comments to average-intensities

commit 29b6755
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 18:59:08 2024 +0530

    Add JsDoc comments to generate_marginal_co2

commit eb4e9ff
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 18:58:53 2024 +0530

    Add JsDoc comments to generate_average_co2

commit 065b410
Author: fershad <fershad@users.noreply.github.com>
Date:   Thu Oct 3 10:11:13 2024 +0000

    Update average annual grid intensities

commit c238d96
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Sep 11 10:30:41 2024 +0800

    v0.16.1

commit d5d3156
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:44:34 2024 +0800

    0.16.1

commit 4b10930
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:43:51 2024 +0800

    v0.16.1

commit 8339284
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:38:33 2024 +0800

    update jsr export

commit 6c0f991
Merge: 8f9097c ed2d8ab
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:35:05 2024 +0800

    Add basic JSR support

commit ed2d8ab
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:20:27 2024 +0800

    update average grid intensities

commit 8f9097c
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:17:29 2024 +0800

    update test constants

commit ce1ada5
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:11:41 2024 +0800

    update version

commit 2962ca1
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:06:52 2024 +0800

    create hosting module

commit 2dd34ec
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:03:33 2024 +0800

    add mod.ts for jsr

commit 2474b1c
Author: Danielle Subject <Danielle.Subject@ibm.com>
Date:   Fri Jul 19 11:06:23 2024 -0400

    Added basic error handling to data fetch in emissions script
@fershad fershad merged commit 2a6369a into thegreenwebfoundation:main Nov 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants