Skip to content

Fix cmip6 models#629

Merged
valeriupredoi merged 23 commits into
masterfrom
fix_cmip6_models
Sep 21, 2020
Merged

Fix cmip6 models#629
valeriupredoi merged 23 commits into
masterfrom
fix_cmip6_models

Conversation

@npgillett

@npgillett npgillett commented May 3, 2020

Copy link
Copy Markdown
Contributor

Before you start, please read CONTRIBUTING.md.

Tasks

  • Create an issue to discuss what you are going to do, if you haven't done so already (and add the link at the bottom)
  • This pull request has a descriptive title that can be used in a changelog
  • Add unit tests
  • Circle/CI tests pass. Status can be seen below your pull request. If the tests are failing, click the link to find out why.
  • Codacy code quality checks pass. Status can be seen below your pull request. If there is an error, click the link to find out why. If you suspect Codacy may be wrong, please ask by commenting.

If you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.


Closes #628

@bouweandela

Copy link
Copy Markdown
Member

@npgillett Thank you for sharing these fixes! Could you please have a look at the code quality suggestions by Codacy? You can read more about contributing Python code in our contribution guidelines.

If you do not know where to start with adding unit tests, maybe @valeriupredoi would be able to help out?

@valeriupredoi

Copy link
Copy Markdown
Contributor

I have just pushed a test for GFDL ESM4 siconc fix, that should give you a good enough example on how to write the tests for the rest of the fixes, basically:

  • follow existing examples;
  • create a data file that should mimic the actual data with its issues;
  • fix that test data file and...
  • check for the existence of the fixes and their parameters.

You can write a draft test and run it immediately via pytest, checks for fails, correct them etc...and then when you think you done you should check the coverage from test-reports - the coverage for your fix is nicely highlighted in a local webpage eg file:///home/USER/ESMValCore/test-reports/coverage_html/esmvalcore_cmor__fixes_cmip6_gfdl_esm4_py.html and there you seee which statements are not covered and need to be tested;

Finally please run isort on the test file to sort the imports and run prospector see if you have any style issues (can correct most of them running yapf -i [test_file] 🍺

@valeriupredoi

Copy link
Copy Markdown
Contributor

Note that for your siconc fix I reckon there's a problem how you build the aux coord:

        typesi = iris.coords.AuxCoord(
            'siconc',
            standard_name='area_type',
            long_name='Sea Ice area type',
            var_name='type',
            units='1',
            bounds=None)

since you are assigning the coordinate data (points) as siconc?

@bouweandela bouweandela added the fix for dataset Related to dataset-specific fix files label May 18, 2020
@npgillett

Copy link
Copy Markdown
Contributor Author

Thanks @valeriupredoi and @bouweandela for the help so far! I managed to revise the code to pass the Codacy checks by adding and removing spaces etc. According to the list my code failed tests in Docker Cloud. But when I click on details I get a 404 - page not found message. What do I need to change to pass the Docker Cloud test? Thanks!

@npgillett

Copy link
Copy Markdown
Contributor Author

Thanks @valeriupredoi for creating the test for the GFDL-ESM4 siconc fix. I took a look at this, but looks like it might take me a while to write something similar for each other model fix...

@npgillett

Copy link
Copy Markdown
Contributor Author

@valeriupredoi Thanks for your comment about the typesi fix above. I have to admit that I don't fully understand the fix, but I found it in an earlier version of ESMValTool - see e.g. here . The code does run without giving an error when the fix is included, but beyond this I can't verify that it is correct. How would you suggest changing this?

@bouweandela

Copy link
Copy Markdown
Member

According to the list my code failed tests in Docker Cloud. But when I click on details I get a 404 - page not found message. What do I need to change to pass the Docker Cloud test?

Sorry about that, we're still in the process of setting that up, so you can ignore those tests for now. The tests that matter are ci/circleci and Codacy.

@bouweandela

Copy link
Copy Markdown
Member

I managed to revise the code to pass the Codacy checks by adding and removing spaces etc.

Note that you can do this automatically by using yapf, as recommended in our contribution guidelines.

@bouweandela

Copy link
Copy Markdown
Member

I'm slightly surprised to see flake8 checks failing in code that you didn't change though, I'll have a look at that tomorrow.

@bouweandela

Copy link
Copy Markdown
Member

I'm slightly surprised to see flake8 checks failing in code that you didn't change though, I'll have a look at that tomorrow.

This was solved after merging the latest master branch into this branch. Could you please have a look at the remaining issues? Let us know if you need help.

@valeriupredoi

Copy link
Copy Markdown
Contributor

fixed a few things there, have a looksee @npgillett - could you pls make sure all fixes have tests attached to them? Lemme know if you need any assistance 🍺

Comment thread tests/integration/cmor/_fixes/cmip6/test_gfdl_esm4.py Outdated
@npgillett

Copy link
Copy Markdown
Contributor Author

@valeriupredoi Thanks very much for your help on this so far - would you be able to review this merge request? I have lost track of this a bit, but it looks like only the Dockercloud test is failing now, and the details link points to a page not found, so I'm not sure if that's a real problem. Hopefully we can get this merged soon... Thanks very much!

@valeriupredoi

Copy link
Copy Markdown
Contributor

sure thing Nathan @npgillett - will have a look first thing in the morning 🍺

@valeriupredoi valeriupredoi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK fixed all the tests and added missing ones 🍺

@valeriupredoi

Copy link
Copy Markdown
Contributor

@bouweandela you wanna have another last look before I merge? 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix for dataset Related to dataset-specific fix files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dataset problem: Fixes for CMIP6 monthly model output

3 participants