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

Fix bug that made preprocessor with fx files fail in rare cases #670

Merged
merged 2 commits into from Jun 22, 2020

Conversation

schlunma
Copy link
Contributor

@schlunma schlunma commented Jun 8, 2020

  • 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
  • Public functions should have a numpy-style docstring so they appear properly in the API documentation. For all other functions a one line docstring is sufficient.
  • If writing a new/modified preprocessor function, please update the documentation
  • 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.
  • Please use yamllint to check that your YAML files do not contain mistakes
  • If you make backward incompatible changes to the recipe format, make a new pull request in the ESMValTool repository and add the link below

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 #448.

@schlunma schlunma added the bug Something isn't working label Jun 8, 2020
@schlunma schlunma self-assigned this Jun 8, 2020
@schlunma schlunma added this to In progress in High priority issues via automation Jun 8, 2020
@schlunma schlunma added this to the v2.0.0 milestone Jun 8, 2020
@schlunma
Copy link
Contributor Author

schlunma commented Jun 8, 2020

Circle CI fails because the following test:

def test_get_variable_from_custom(self):
"""Get a variable from default."""
self.variables_info.strict = False
var = self.variables_info.get_variable('A1', 'swcre')
self.assertEqual(var.short_name, 'swcre')
self.assertEqual(var.frequency, '')
var = self.variables_info.get_variable('day', 'swcre')
self.assertEqual(var.short_name, 'swcre')
self.assertEqual(var.frequency, '')

This fails because var.frequency is None in the second case now instead of the expected ''. Is this behavior intended @jvegasbsc ? In this test, the custom table swcre is read, which does not specify frequency. So I guess somehow the use of day sets the frequency to None. Before this fix, the frequency was (falsely) set to '' in the call var = self.variables_info.get_variable('A1', 'swcre'), so this test didn't fail.

All other tables entries are fine though (e.g. long_name, dimensions, etc.), only the frequency part fails.

@jvegreg
Copy link
Contributor

jvegreg commented Jun 8, 2020

The frequency for custom variables was set to None at read time. I changed it to be set to the empty string so it is consistent with all the others

@schlunma
Copy link
Contributor Author

schlunma commented Jun 8, 2020

I successfully tested recipe_anav13jclim.yml with this, so this fixes ESMValGroup/ESMValTool#1548.

High priority issues automation moved this from In progress to Reviewer approved Jun 8, 2020
Copy link
Member

@bouweandela bouweandela left a comment

Choose a reason for hiding this comment

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

@mattiarighi Could you please run a final test and merge?

Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

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

cheers @schlunma 🍺

@mattiarighi mattiarighi merged commit c5ffda0 into master Jun 22, 2020
High priority issues automation moved this from Reviewer approved to Done Jun 22, 2020
@mattiarighi mattiarighi deleted the fix_448 branch June 22, 2020 13:39
@bouweandela bouweandela added the preprocessor Related to the preprocessor label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preprocessor Related to the preprocessor
Projects
Development

Successfully merging this pull request may close these issues.

Using fx_files for preprocessor fails in rare cases
5 participants