Closed aidanheerdegen closed 6 months ago
Hello @aidanheerdegen! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
payu/models/cable.py
:Line 26:1: W293 blank line contains whitespace Line 61:80: E501 line too long (86 > 79 characters) Line 131:80: E501 line too long (89 > 79 characters)
test/models/test_cable.py
:Line 26:80: E501 line too long (81 > 79 characters) Line 30:80: E501 line too long (82 > 79 characters) Line 47:80: E501 line too long (80 > 79 characters) Line 50:80: E501 line too long (88 > 79 characters)
@ccarouge I have implemented a basic templating scheme for the cable.nml
file.
There is an example of it's use in the template
branch at this repo:
https://github.com/aidanheerdegen/cable_test/tree/template
The basic idea is to use $year
in the cable.nml
file, and read the value of $year
from the previous restart, e.g. archive/restart007/cable.res.yaml
, which for this example looks like so:
year: 1904
It's still a bit rough. There is no way to start this process without a cable.res.yaml
file existing, as I wasn't sure how to get the value of year otherwise.
Just looked, and I can see it is available in the restart.nc
file, so that would be the next step, interrogate that file if there is no cable.res.yaml
file.
I got notice that a CircleCI build failed. This is out of date because @dougiesquire has updated the CI to use GitHub Workflows.
I/we should rebase this and force push to the repo to get it up to date with those changes. Note that there is a conflict in payu/models/__init__.py
which needs to be manually resolved.
Happy to go through the process next week @SeanBryan51 if that is helpful.
In this payu experiment, we only have met forcing files from 1903 to 1909 - causing the model to crash when the year value exceeds 1909. Should we include logic to repeat the forcing once the model exceeds the duration of the forcing?
To implement this, I'm thinking we:
$year
with $forcing_year
in the templating scheme to distinguish the 'model' year from the 'forcing' year.forcing_year
in cable.res.yaml which specifies the forcing year to use. If the forcing year is not specified, then the CABLE driver will use year
as the forcing year.self.optional_config_files
attribute) which specifies the min/max forcing year.@aidanheerdegen do you see any issues with this?
@SeanBryan51 and I had a IRL chat. I believe I suggested a setup
script could be used to update links to forcing files to make them cycle correctly.
Is that still an workable option?
I think I'm happy with the implementation of the driver. @aidanheerdegen or @jo-basevi are you happy to give this a review? Whenever you guys have the time.
Happy to review .. so my first suggestion is to add some tests for your driver. Specifically the forcing logic, but if there are any other you can think of that might be useful add them to. There are some tests under payu/test/models/
so take a look for some prior art if that helps.
No-one wants to hear "write tests", but you know you should :) .. particularly the guy that just gave a skillshare on pytest
!
;)
@jo-basevi has written some nice ones recently using parameterised decorators if you want inspiration.
@aidanheerdegen I have added some tests for the forcing logic. I've tried to make the tests light weight by creating a separate helper function (the private methods in the Cable
class had too much global state to write clean tests).
@SeanBryan51 are you ready to merge this? Do you need another review?
@aidanheerdegen after I clean up the commit history this should be all good to go in.
Just doing some final checks to make sure things are working.
Ready when you are @aidanheerdegen
Add model driver for CABLE model
http://climate-cms.wikis.unsw.edu.au/CABLE
Closes #313