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

Interpolation between base_inv_dict years for contrail climate impact calculations of single flights #46

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

liammegill
Copy link
Collaborator

Description

This pull request adds functionality that allows the years defined in inv_dict to vary independently from those defined in base_inv_dict. This is helpful if the climate impact of a flight or yearly inventory in for example the year 2024 is desired, but global emission inventories only exist in for example the years 2020 and 2050.

The new function interp_base_inv_dict uses a custom nearest neighbour method to regrid the base emission inventories onto the contrail grid, then linearly interpolates between them to get the values at any years in inv_dict that are not defined in base_inv_dict. It is not possible to include years in inv_dict that are outside of the range of years defined by the inventories in base_inv_dict. Going forward, I will consider whether this could be possible if one of the scaling functions were to be used on the base emission inventories.

Linked issues

Closes #45.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • Introduced pytest test classes TestCheckContInput and TestInterpBaseInvDict in tests/calc_cont_test.py
  • Using randomly generated and DEPA 2050 data

Test configuration:

  • Operating system: Windows 11

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@liammegill liammegill added type: feature Brand new functionality, features, pages, workflows, endpoints etc. module: contrails Related to the contrail module labels Nov 15, 2024
@liammegill liammegill self-assigned this Nov 15, 2024
@liammegill liammegill linked an issue Nov 15, 2024 that may be closed by this pull request
1 task
Copy link
Collaborator

@stefan-voelk stefan-voelk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@liammegill liammegill added this to the v1.0.0 milestone Nov 18, 2024
@liammegill liammegill merged commit 804b31c into dev Nov 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: contrails Related to the contrail module type: feature Brand new functionality, features, pages, workflows, endpoints etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow input inventory years within range of base inventory years
2 participants