Skip to content

Expand functionality#338

Open
Alessimc wants to merge 30 commits into
metno:masterfrom
Alessimc:expand-functionality
Open

Expand functionality#338
Alessimc wants to merge 30 commits into
metno:masterfrom
Alessimc:expand-functionality

Conversation

@Alessimc

@Alessimc Alessimc commented Jul 29, 2024

Copy link
Copy Markdown

Summary:

  • Updated elements in mmd_elements.yaml
  • Implemented a way to include non mmd elements
  • Removed CF table from template
    • external_variables is the only elements left in cf_elements.yaml that has not been included in mmd_elements.yaml
  • Added mmd_to_adc.py to generate adc_elements.py

Related issue:

Suggested reviewer(s):

Reviewer checklist:

  • The headers of all files contain a reference to the repository license (i.e., "License: This file is part of py-mmd-tools, licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0)")
  • 100% test coverage of new code - meaning:
    • The overall test coverage increased or remained the same as before
    • Every function is accompanied with a test suite
    • Tests are both positive (testing that the function work as intended with valid data) and negative (testing that the function behaves as expected with invalid data, e.g., that correct exceptions are thrown)
    • Functions with optional arguments have separate tests for all options
  • Examples are supported by doctests
  • All tests are passing
  • All names (e.g., files, classes, functions, variables) are explicit
  • Documentation (as docstrings) is complete and understandable

The checklist is based on the S-ENDA conventions and definition of done (see https://s-enda-documentation.readthedocs.io/en/latest/general_conventions.html). The above points are not necessarily relevant to all contributions. In that case, please add a short explanation to help the reviewer.

@mortenwh mortenwh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks - it looks promising. See inline comments. In addition, flake errors should be resolved, and the coverage should be brought back to 100%.

Comment thread py_mmd_tools/adc_elements.yaml Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is ACDD elements, right? Or are there additional ones from/for ADC? Maybe better to call it "ACDD_elements.yaml"?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

According to https://adc.met.no/node/4 there are five attributes that are "Global attributes not being part of ACDD, but that are parsed" by ADC. This would be:

  • iso_topic_category
  • activity_type
  • operational_status
  • featureType
  • wigos_id (as you mentioned this can be removed anyway)

But I could call it ACDD_elements.yaml and maybe add a disclaimer in the comments for these atrributes?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The task is focused on making a yaml for ACDD isn't it? I suggest taking out those elements that are not ACDD, and as you suggest, call it ACDD_elements.yaml. Not sure about the others but featureType at least is CF and is already in cf_elements.yaml. mmd_elements.yaml should cover the ADC needs as far as I know (also the wigos_id).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Originally I thought we were making a yaml for Arctic Data Centre requirements like this adc_required_global_attributes.yaml

I have now made a acdd_elements.yaml as suggested.

Previously we discussed possibly removing the cf_elements.yaml since ACDD 1.3 adopts all CF 1.6 (and presumably later versions) global attributes. All cf elements except external_variables (I couldn't find it in ACDD) has already been added to mmd_elements.yaml.

So the wigos_id needs of ADC are covered by the platform/instrument attribute in mmd_elements.yaml?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes, the data producer should add the station url as platform_resource, e.g., https://oscar.wmo.int/surface/#/search/station/stationReportDetails/0-20000-0-01447, and use the name provided there.

similarly, the instrument should be added with name and resource from the oscar database.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if this cannot be used, we should in principle create another yaml file adc_elements.adoc containing the wigos_id field but I can't understand that this is necessary.

Comment thread py_mmd_tools/adc_elements.yaml Outdated
Comment thread py_mmd_tools/mmd_elements.yaml Outdated
Comment thread py_mmd_tools/mmd_elements.yaml Outdated
Comment thread py_mmd_tools/mmd_elements.yaml Outdated
Comment thread py_mmd_tools/mmd_elements.yaml Outdated
Comment thread py_mmd_tools/mmd_to_adc.py Outdated
Comment thread py_mmd_tools/mmd_to_adc.py Outdated
Comment thread py_mmd_tools/mmd_to_adc.py Outdated
Comment thread py_mmd_tools/yaml_to_adoc.py Outdated
@Alessimc

Copy link
Copy Markdown
Author

I have 3 tests failing:

FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_missing_platform_vocabulary - AssertionError: Lists differ: [{'Short_Name': 'Envisat', 'short_name': '[199 chars]at'}] != []
FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_platform_vocabulary_invalid_url - AssertionError: Lists differ: [{'Short_Name': 'Envisat', 'short_name': '[199 chars]at'}] != []
FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_polygon_is_not_wkt - PermissionError: [Errno 13] Permission denied: '/home/alessio/MET/repos/py-mmd-tools/tests/data/reference_nc_fail.nc'

but these are also failing on the master branch.

@mortenwh

Copy link
Copy Markdown
Collaborator

I have 3 tests failing:

FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_missing_platform_vocabulary - AssertionError: Lists differ: [{'Short_Name': 'Envisat', 'short_name': '[199 chars]at'}] != []
FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_platform_vocabulary_invalid_url - AssertionError: Lists differ: [{'Short_Name': 'Envisat', 'short_name': '[199 chars]at'}] != []
FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_polygon_is_not_wkt - PermissionError: [Errno 13] Permission denied: '/home/alessio/MET/repos/py-mmd-tools/tests/data/reference_nc_fail.nc'

but these are also failing on the master branch.

The master branch seems good. Maybe it's just a local problem?

@mortenwh

Copy link
Copy Markdown
Collaborator

I have 3 tests failing:

FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_missing_platform_vocabulary - AssertionError: Lists differ: [{'Short_Name': 'Envisat', 'short_name': '[199 chars]at'}] != []
FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_platform_vocabulary_invalid_url - AssertionError: Lists differ: [{'Short_Name': 'Envisat', 'short_name': '[199 chars]at'}] != []
FAILED tests/test_nc_to_mmd.py::TestNC2MMD::test_polygon_is_not_wkt - PermissionError: [Errno 13] Permission denied: '/home/alessio/MET/repos/py-mmd-tools/tests/data/reference_nc_fail.nc'

but these are also failing on the master branch.

The master branch seems good. Maybe it's just a local problem?

No - I get the same. Quite surprising, as this should not happen. I'll look into it

@mortenwh

Copy link
Copy Markdown
Collaborator

#340 - do you want to try @Alessimc ?

@mortenwh

Copy link
Copy Markdown
Collaborator

I have solved it: #341

We can update this branch when that is merged

@mortenwh

Copy link
Copy Markdown
Collaborator

@Alessimc - the tests are passing now, except coverage. Can you add tests for the new code?

@Alessimc

Copy link
Copy Markdown
Author

@Alessimc - the tests are passing now, except coverage. Can you add tests for the new code?

Absolutely! I will try to look into this later today.

Sorry for some late responses. My work hours are reduced now that university courses have started again.

@mortenwh

mortenwh commented Sep 3, 2024

Copy link
Copy Markdown
Collaborator

@Alessimc - the tests are passing now, except coverage. Can you add tests for the new code?

Absolutely! I will try to look into this later today.

Sorry for some late responses. My work hours are reduced now that university courses have started again.

No problem, I see some tests are still failing but you can pick up this when it suits you.

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.

2 participants