ggebbie / TMItransient.jl

Transient simulations with the TMI circulation matrix
MIT License
0 stars 1 forks source link

Bh responseatloc #22

Closed b-r-hamilton closed 1 year ago

b-r-hamilton commented 1 year ago

This is my attempt at the code we discussed on Friday - I wrote a version of globalmean_stepresponse that takes in any type of analysis function that acts upon a Field, and wrote some tests to check that...

  1. The new function (called stepresponse) matches the output of globalmean_stepresponse when the provided function is mean
  2. The output from the stepresponse function can be acted upon by the globalmean_impulseresponse. This works if the function provided to stepresponse outputs a Float or a Vector (at each timestep), but does not work if the function outputs a Field because / isn't defined for a Field (also it seems like subtraction isn't working quite correctly for a Field, will write a MWE and post an issue on that when I get a chance)
  3. The integral of $\bar{G}$ is equivalent to the output of the TMI.meanage function

Some things that I didn't change but I think could be changed

  1. globalmean_impulseresponse could be renamed to impulseresponse because it's actually general enough to act upon any function (not just the global mean)

Things that I'd like feedback on

  1. Is there a better way to define a function that takes in an arbitrary number of arguments than what I did in stepresponse? Right now it just takes in a Vector and unpacks it when it calls the evaluation function.
b-r-hamilton commented 1 year ago

One more note: when I compare the globalmean_stepresponse and my new stepresponse, I don't compare the first timestep, because on my version of TMItransient, it was set to 0 after the fact. I see that that step has been removed in the new version of TMItransient, so I think that can be fixed in my current code (mostly writing this so I don't forget to change that)

ggebbie commented 1 year ago

Codecov Report

Patch coverage: 94.73% and project coverage change: +4.16% :tada:

Comparison is base (3c02ec0) 41.11% compared to head (a505d08) 45.28%. Report is 7 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #22 +/- ## ========================================== + Coverage 41.11% 45.28% +4.16% ========================================== Files 1 1 Lines 197 212 +15 ========================================== + Hits 81 96 +15 Misses 116 116 ``` | [Files Changed](https://app.codecov.io/gh/ggebbie/TMItransient.jl/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=G+Jake+Gebbie) | Coverage Δ | | |---|---|---| | [src/TMItransient.jl](https://app.codecov.io/gh/ggebbie/TMItransient.jl/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=G+Jake+Gebbie#diff-c3JjL1RNSXRyYW5zaWVudC5qbA==) | `45.28% <94.73%> (+4.16%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.