Skip to content

Conversation

@emanuel-schmid
Copy link
Collaborator

@emanuel-schmid emanuel-schmid commented Aug 8, 2023

Changes proposed in this PR:

  • removes tag attribute from Hazard and subclasses

This PR fixes #

PR Author Checklist

PR Reviewer Checklist

@chahank
Copy link
Member

chahank commented Aug 8, 2023

Looks good to me! Can you please also update the changelog?

hf_data.get(var_name))
elif var_name == 'tag':
# legacy behavior: haz_type used to be part of the hazard tag
if "haz_type" in hf_data.keys():
Copy link
Member

Choose a reason for hiding this comment

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

Will this not make it impossible to read files created with previous versions of CLIMADA as the haz_type cannot be loaded?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question! And if so it should show in the integration test, shouldn't it?

Copy link
Member

Choose a reason for hiding this comment

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

If the integration tests would be complete yes. But they are not. Ideally, we should write one now. (actually a unit test).

Copy link
Collaborator Author

@emanuel-schmid emanuel-schmid Aug 28, 2023

Choose a reason for hiding this comment

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

Actually it's not a problem: the hazard type is read below in lines

    elif isinstance(var_val, np.ndarray) and var_val.ndim == 1:
        hazard_kwargs[var_name] = np.array(hf_data.get(var_name))

(file_name, description and haz_type have always been attributes of the hdf5 dataset itself and never of any tag dataset beneath it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The test for it is climada.test.test_api_client.TestClient.test_get_hazard.

Comment on lines 2160 to 2162
try:
comment = u_hdf5.get_string(data[var_names['var_name']['comment']])
attrs["description"] += ' ' + comment
Copy link
Member

Choose a reason for hiding this comment

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

What is this attribute description? Is this not part of the tag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 I'll remove it as well.

Copy link
Member

@peanutfun peanutfun 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, nice work! What about the failing compatibility test? The adjustment on the Pythonpath is gone from the changes, somehow.

@emanuel-schmid emanuel-schmid merged commit b729e89 into develop Aug 30, 2023
@emanuel-schmid emanuel-schmid deleted the feature/remove_tag_hazard branch August 30, 2023 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants