CMIP7-data-request-api 1.4__tar.gz → 1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/PKG-INFO +2 -2
  2. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/README.md +1 -1
  3. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/CMIP7_data_request_api.egg-info/PKG-INFO +2 -2
  4. cmip7_data_request_api-1.5/data_request_api/CMIP7_data_request_api.egg-info/SOURCES.txt +46 -0
  5. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/command_line/get_variables_metadata.py +35 -8
  6. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/query/data_request.py +1 -1
  7. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/query/dreq_query.py +47 -17
  8. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/query/vocabulary_server.py +3 -0
  9. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_consolidation.py +1 -1
  10. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_data_request.py +144 -127
  11. cmip7_data_request_api-1.5/data_request_api/data_request_api/version.py +24 -0
  12. cmip7_data_request_api-1.4/.DS_Store +0 -0
  13. cmip7_data_request_api-1.4/.github/.DS_Store +0 -0
  14. cmip7_data_request_api-1.4/.github/workflows/pip_install.yml +0 -50
  15. cmip7_data_request_api-1.4/.github/workflows/publish2pypi.yml +0 -127
  16. cmip7_data_request_api-1.4/.github/workflows/updates.yml +0 -47
  17. cmip7_data_request_api-1.4/.gitignore +0 -184
  18. cmip7_data_request_api-1.4/binder/environment.yml +0 -13
  19. cmip7_data_request_api-1.4/binder/postBuild +0 -3
  20. cmip7_data_request_api-1.4/data_request_api/.DS_Store +0 -0
  21. cmip7_data_request_api-1.4/data_request_api/CMIP7_data_request_api.egg-info/SOURCES.txt +0 -154
  22. cmip7_data_request_api-1.4/data_request_api/data_request_api/content/README.MD +0 -106
  23. cmip7_data_request_api-1.4/data_request_api/data_request_api/content/transform.json +0 -339
  24. cmip7_data_request_api-1.4/data_request_api/data_request_api/query/filtering.json +0 -24
  25. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/DR_raw_not-consolidate_content.json +0 -414
  26. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/DR_release_not-consolidate_content.json +0 -414
  27. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/DR_release_not-consolidate_content_dump.txt +0 -255
  28. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/VS_raw_not-consolidate_content.json +0 -7425
  29. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/VS_release_not-consolidate_content.json +0 -6547
  30. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/dreq_raw_export.json +0 -33093
  31. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/dreq_release_export.json +0 -31458
  32. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/raw_not-consolidate_output_format.json +0 -33093
  33. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/raw_not-consolidate_output_transform.json +0 -7788
  34. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/release_not-consolidate_output_format.json +0 -31458
  35. cmip7_data_request_api-1.4/data_request_api/data_request_api/tests/test_datasets/release_not-consolidate_output_transform.json +0 -6910
  36. cmip7_data_request_api-1.4/data_request_api/data_request_api/version.py +0 -34
  37. cmip7_data_request_api-1.4/docs/data_request_api/command_line/compare_variables.html +0 -388
  38. cmip7_data_request_api-1.4/docs/data_request_api/command_line/config.html +0 -132
  39. cmip7_data_request_api-1.4/docs/data_request_api/command_line/estimate_dreq_volume.html +0 -555
  40. cmip7_data_request_api-1.4/docs/data_request_api/command_line/export_dreq_lists_json.html +0 -296
  41. cmip7_data_request_api-1.4/docs/data_request_api/command_line/get_variables_metadata.html +0 -166
  42. cmip7_data_request_api-1.4/docs/data_request_api/command_line/index.html +0 -98
  43. cmip7_data_request_api-1.4/docs/data_request_api/content/consolidate_export.html +0 -537
  44. cmip7_data_request_api-1.4/docs/data_request_api/content/dreq_content.html +0 -753
  45. cmip7_data_request_api-1.4/docs/data_request_api/content/dump_transformation.html +0 -814
  46. cmip7_data_request_api-1.4/docs/data_request_api/content/index.html +0 -98
  47. cmip7_data_request_api-1.4/docs/data_request_api/content/mapping_table.html +0 -151
  48. cmip7_data_request_api-1.4/docs/data_request_api/content/utils.html +0 -66
  49. cmip7_data_request_api-1.4/docs/data_request_api/index.html +0 -98
  50. cmip7_data_request_api-1.4/docs/data_request_api/query/data_request.html +0 -3320
  51. cmip7_data_request_api-1.4/docs/data_request_api/query/dreq_classes.html +0 -991
  52. cmip7_data_request_api-1.4/docs/data_request_api/query/dreq_query.html +0 -1707
  53. cmip7_data_request_api-1.4/docs/data_request_api/query/index.html +0 -95
  54. cmip7_data_request_api-1.4/docs/data_request_api/query/vocabulary_server.html +0 -636
  55. cmip7_data_request_api-1.4/docs/data_request_api/stable/content/consolidate_export.html +0 -492
  56. cmip7_data_request_api-1.4/docs/data_request_api/stable/content/dreq_content.html +0 -619
  57. cmip7_data_request_api-1.4/docs/data_request_api/stable/content/dump_transformation.html +0 -676
  58. cmip7_data_request_api-1.4/docs/data_request_api/stable/content/index.html +0 -93
  59. cmip7_data_request_api-1.4/docs/data_request_api/stable/content/mapping_table.html +0 -130
  60. cmip7_data_request_api-1.4/docs/data_request_api/stable/index.html +0 -88
  61. cmip7_data_request_api-1.4/docs/data_request_api/stable/query/data_request.html +0 -3114
  62. cmip7_data_request_api-1.4/docs/data_request_api/stable/query/dreq_classes.html +0 -785
  63. cmip7_data_request_api-1.4/docs/data_request_api/stable/query/dreq_query.html +0 -1385
  64. cmip7_data_request_api-1.4/docs/data_request_api/stable/query/index.html +0 -95
  65. cmip7_data_request_api-1.4/docs/data_request_api/stable/query/vocabulary_server.html +0 -630
  66. cmip7_data_request_api-1.4/docs/data_request_api/stable/utilities/config.html +0 -214
  67. cmip7_data_request_api-1.4/docs/data_request_api/stable/utilities/decorators.html +0 -122
  68. cmip7_data_request_api-1.4/docs/data_request_api/stable/utilities/index.html +0 -98
  69. cmip7_data_request_api-1.4/docs/data_request_api/stable/utilities/logger.html +0 -179
  70. cmip7_data_request_api-1.4/docs/data_request_api/stable/utilities/parser.html +0 -91
  71. cmip7_data_request_api-1.4/docs/data_request_api/stable/utilities/tools.html +0 -150
  72. cmip7_data_request_api-1.4/docs/data_request_api/tests/index.html +0 -152
  73. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_cli.html +0 -1562
  74. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_config.html +0 -384
  75. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_config_cli.html +0 -365
  76. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_consolidation.html +0 -244
  77. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_data_request.html +0 -3886
  78. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_decorator.html +0 -219
  79. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_dreq_content.html +0 -790
  80. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_dreq_query.html +0 -313
  81. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_dump_transformation.html +0 -626
  82. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_optimize.html +0 -485
  83. cmip7_data_request_api-1.4/docs/data_request_api/tests/test_vocabulary_server.html +0 -608
  84. cmip7_data_request_api-1.4/docs/data_request_api/utilities/config.html +0 -267
  85. cmip7_data_request_api-1.4/docs/data_request_api/utilities/decorators.html +0 -128
  86. cmip7_data_request_api-1.4/docs/data_request_api/utilities/index.html +0 -98
  87. cmip7_data_request_api-1.4/docs/data_request_api/utilities/logger.html +0 -179
  88. cmip7_data_request_api-1.4/docs/data_request_api/utilities/parser.html +0 -121
  89. cmip7_data_request_api-1.4/docs/data_request_api/utilities/tools.html +0 -150
  90. cmip7_data_request_api-1.4/docs/data_request_api/version.html +0 -66
  91. cmip7_data_request_api-1.4/docs/static/3boxes_schema.png +0 -0
  92. cmip7_data_request_api-1.4/env.yml +0 -11
  93. cmip7_data_request_api-1.4/launch_test_with_coverage.sh +0 -49
  94. cmip7_data_request_api-1.4/notebooks/HowTo-00_Install_the_DR_Software.ipynb +0 -191
  95. cmip7_data_request_api-1.4/notebooks/HowTo-01_Import_and_Load_the_DR.ipynb +0 -349
  96. cmip7_data_request_api-1.4/notebooks/HowTo-02_Discover_What_is_in_DR.ipynb +0 -378
  97. cmip7_data_request_api-1.4/notebooks/HowTo-03a_Find_Experiments_and_Variables_for_given_Opportunities.ipynb +0 -251
  98. cmip7_data_request_api-1.4/notebooks/HowTo-03b_Find_Experiments_and_Variables_for_given_Opportunities.ipynb +0 -168
  99. cmip7_data_request_api-1.4/notebooks/HowTo-04a_View_Attributes_of_Experiments_and_Variables.ipynb +0 -158
  100. cmip7_data_request_api-1.4/notebooks/HowTo-04b_View_Attributes_of_Variables.ipynb +0 -189
  101. cmip7_data_request_api-1.4/notebooks/HowTo-05_Apply_Various_Search_Critria.ipynb +0 -314
  102. cmip7_data_request_api-1.4/notebooks/README.md +0 -1
  103. cmip7_data_request_api-1.4/notebooks/outdir/.gitkeep +0 -0
  104. cmip7_data_request_api-1.4/requirements.txt +0 -7
  105. cmip7_data_request_api-1.4/scripts/branding/README.md +0 -33
  106. cmip7_data_request_api-1.4/scripts/branding/branded_variable_attributes.yaml +0 -17
  107. cmip7_data_request_api-1.4/scripts/branding/compare_branded_variables.py +0 -269
  108. cmip7_data_request_api-1.4/scripts/branding/generate_branded_names.py +0 -118
  109. cmip7_data_request_api-1.4/scripts/check_consolidation.py +0 -113
  110. cmip7_data_request_api-1.4/scripts/check_consolidation2.py +0 -559
  111. cmip7_data_request_api-1.4/scripts/check_consolidation2_list-all-diffs.py +0 -569
  112. cmip7_data_request_api-1.4/scripts/check_consolidation_and_transformation.py +0 -627
  113. cmip7_data_request_api-1.4/scripts/check_variables_attributes.py +0 -103
  114. cmip7_data_request_api-1.4/scripts/database_transformation.py +0 -60
  115. cmip7_data_request_api-1.4/scripts/examples/requested_v1.2.2.3_cmip6names.json +0 -97657
  116. cmip7_data_request_api-1.4/scripts/examples/requested_v1.2.2.3_cmip7names.json +0 -97657
  117. cmip7_data_request_api-1.4/scripts/examples/variables_v1.2.2.3_cmip6names.json +0 -51338
  118. cmip7_data_request_api-1.4/scripts/examples/variables_v1.2.2.3_cmip7names.json +0 -51338
  119. cmip7_data_request_api-1.4/scripts/sandbox/create_brand_name.py +0 -216
  120. cmip7_data_request_api-1.4/scripts/workflow_example.py +0 -67
  121. cmip7_data_request_api-1.4/scripts/workflow_example_2.py +0 -152
  122. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/LICENSE +0 -0
  123. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/CMIP7_data_request_api.egg-info/dependency_links.txt +0 -0
  124. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/CMIP7_data_request_api.egg-info/entry_points.txt +0 -0
  125. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/CMIP7_data_request_api.egg-info/requires.txt +0 -0
  126. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/CMIP7_data_request_api.egg-info/top_level.txt +0 -0
  127. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/__init__.py +0 -0
  128. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/command_line/__init__.py +0 -0
  129. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/command_line/compare_variables.py +0 -0
  130. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/command_line/config.py +0 -0
  131. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/command_line/estimate_dreq_volume.py +0 -0
  132. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/command_line/export_dreq_lists_json.py +0 -0
  133. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/content/__init__.py +0 -0
  134. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/content/consolidate_export.py +0 -0
  135. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/content/dreq_content.py +0 -0
  136. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/content/dump_transformation.py +0 -0
  137. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/content/mapping_table.py +0 -0
  138. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/content/utils.py +0 -0
  139. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/query/__init__.py +0 -0
  140. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/query/dreq_classes.py +0 -0
  141. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/__init__.py +0 -0
  142. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_cli.py +0 -0
  143. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_config.py +0 -0
  144. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_config_cli.py +0 -0
  145. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_decorator.py +0 -0
  146. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_dreq_content.py +0 -0
  147. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_dreq_query.py +0 -0
  148. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_dump_transformation.py +0 -0
  149. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_optimize.py +0 -0
  150. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/tests/test_vocabulary_server.py +0 -0
  151. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/utilities/__init__.py +0 -0
  152. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/utilities/config.py +0 -0
  153. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/utilities/decorators.py +0 -0
  154. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/utilities/logger.py +0 -0
  155. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/utilities/parser.py +0 -0
  156. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/data_request_api/data_request_api/utilities/tools.py +0 -0
  157. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/pyproject.toml +0 -0
  158. {cmip7_data_request_api-1.4 → cmip7_data_request_api-1.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CMIP7_data_request_api
3
- Version: 1.4
3
+ Version: 1.5
4
4
  Summary: A programmatic interface to the CMIP7 Data Request
5
5
  Author: James Anstey, Gaëlle Rigoudy, Martin Schupfner, Matthew Mizielinski, Daniel Ellis, Elisabeth Dingley, Marie-Pierre Moine
6
6
  License: MIT License
@@ -408,7 +408,7 @@ Call example:
408
408
  "cmip6_table": "AERmon",
409
409
  "physical_parameter_name": "abs550aer",
410
410
  "variableRootDD": "abs550aer",
411
- "branding_label": "tavg-u-hxy-u",
411
+ "branding_suffix": "tavg-u-hxy-u",
412
412
  "branded_variable_name": "abs550aer_tavg-u-hxy-u",
413
413
  "region": "glb",
414
414
  "cmip6_compound_name": "AERmon.abs550aer",
@@ -367,7 +367,7 @@ Call example:
367
367
  "cmip6_table": "AERmon",
368
368
  "physical_parameter_name": "abs550aer",
369
369
  "variableRootDD": "abs550aer",
370
- "branding_label": "tavg-u-hxy-u",
370
+ "branding_suffix": "tavg-u-hxy-u",
371
371
  "branded_variable_name": "abs550aer_tavg-u-hxy-u",
372
372
  "region": "glb",
373
373
  "cmip6_compound_name": "AERmon.abs550aer",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CMIP7_data_request_api
3
- Version: 1.4
3
+ Version: 1.5
4
4
  Summary: A programmatic interface to the CMIP7 Data Request
5
5
  Author: James Anstey, Gaëlle Rigoudy, Martin Schupfner, Matthew Mizielinski, Daniel Ellis, Elisabeth Dingley, Marie-Pierre Moine
6
6
  License: MIT License
@@ -408,7 +408,7 @@ Call example:
408
408
  "cmip6_table": "AERmon",
409
409
  "physical_parameter_name": "abs550aer",
410
410
  "variableRootDD": "abs550aer",
411
- "branding_label": "tavg-u-hxy-u",
411
+ "branding_suffix": "tavg-u-hxy-u",
412
412
  "branded_variable_name": "abs550aer_tavg-u-hxy-u",
413
413
  "region": "glb",
414
414
  "cmip6_compound_name": "AERmon.abs550aer",
@@ -0,0 +1,46 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ data_request_api/CMIP7_data_request_api.egg-info/PKG-INFO
5
+ data_request_api/CMIP7_data_request_api.egg-info/SOURCES.txt
6
+ data_request_api/CMIP7_data_request_api.egg-info/dependency_links.txt
7
+ data_request_api/CMIP7_data_request_api.egg-info/entry_points.txt
8
+ data_request_api/CMIP7_data_request_api.egg-info/requires.txt
9
+ data_request_api/CMIP7_data_request_api.egg-info/top_level.txt
10
+ data_request_api/data_request_api/__init__.py
11
+ data_request_api/data_request_api/version.py
12
+ data_request_api/data_request_api/command_line/__init__.py
13
+ data_request_api/data_request_api/command_line/compare_variables.py
14
+ data_request_api/data_request_api/command_line/config.py
15
+ data_request_api/data_request_api/command_line/estimate_dreq_volume.py
16
+ data_request_api/data_request_api/command_line/export_dreq_lists_json.py
17
+ data_request_api/data_request_api/command_line/get_variables_metadata.py
18
+ data_request_api/data_request_api/content/__init__.py
19
+ data_request_api/data_request_api/content/consolidate_export.py
20
+ data_request_api/data_request_api/content/dreq_content.py
21
+ data_request_api/data_request_api/content/dump_transformation.py
22
+ data_request_api/data_request_api/content/mapping_table.py
23
+ data_request_api/data_request_api/content/utils.py
24
+ data_request_api/data_request_api/query/__init__.py
25
+ data_request_api/data_request_api/query/data_request.py
26
+ data_request_api/data_request_api/query/dreq_classes.py
27
+ data_request_api/data_request_api/query/dreq_query.py
28
+ data_request_api/data_request_api/query/vocabulary_server.py
29
+ data_request_api/data_request_api/tests/__init__.py
30
+ data_request_api/data_request_api/tests/test_cli.py
31
+ data_request_api/data_request_api/tests/test_config.py
32
+ data_request_api/data_request_api/tests/test_config_cli.py
33
+ data_request_api/data_request_api/tests/test_consolidation.py
34
+ data_request_api/data_request_api/tests/test_data_request.py
35
+ data_request_api/data_request_api/tests/test_decorator.py
36
+ data_request_api/data_request_api/tests/test_dreq_content.py
37
+ data_request_api/data_request_api/tests/test_dreq_query.py
38
+ data_request_api/data_request_api/tests/test_dump_transformation.py
39
+ data_request_api/data_request_api/tests/test_optimize.py
40
+ data_request_api/data_request_api/tests/test_vocabulary_server.py
41
+ data_request_api/data_request_api/utilities/__init__.py
42
+ data_request_api/data_request_api/utilities/config.py
43
+ data_request_api/data_request_api/utilities/decorators.py
44
+ data_request_api/data_request_api/utilities/logger.py
45
+ data_request_api/data_request_api/utilities/parser.py
46
+ data_request_api/data_request_api/utilities/tools.py
@@ -5,6 +5,7 @@ Extract metadata of CMOR variables and write them to a json file.
5
5
 
6
6
  import argparse
7
7
  import os
8
+ from textwrap import dedent
8
9
 
9
10
  import data_request_api.content.dreq_content as dc
10
11
  import data_request_api.query.dreq_query as dq
@@ -17,14 +18,15 @@ def parse_args():
17
18
  '''
18
19
 
19
20
  parser = argparse.ArgumentParser(
20
- description='Get metadata of CMOR variables (e.g., cell_methods, dimensions, ...) and write it to a json file.'
21
+ formatter_class=argparse.RawTextHelpFormatter,
22
+ description='Write data request variables metadata (cell_methods, dimensions, ...) to json or csv file.'
21
23
  )
22
24
 
23
25
  # Positional (mandatory) input arguments
24
26
  parser.add_argument('dreq_version', choices=dc.get_versions(),
25
27
  help='data request version')
26
28
  parser.add_argument('outfile', type=str,
27
- help='output file containing metadata of requested variables, can be ".json" or ".csv" file')
29
+ help='output file (specify ".json" or ".csv" extension)')
28
30
 
29
31
  sep = ','
30
32
 
@@ -35,13 +37,36 @@ def parse_args():
35
37
  input_args = [s for s in input_args if s not in ['']]
36
38
  return input_args
37
39
 
38
- # Optional input arguments
40
+ parser.add_argument('-a', '--attributes', type=parse_input_list,
41
+ help=dedent(f'''\
42
+ include only the specified variable metadata attributes, examples:
43
+ -a frequency{sep}modeling_realm{sep}region
44
+ -a branded_variable_name{sep}long_name{sep}standard_name
45
+ -a dimensions{sep}cell_methods
46
+ '''))
39
47
  parser.add_argument('-cn', '--compound_names', type=parse_input_list,
40
- help=f'include only variables with the specified compound names, example: -cn Amon.tas{sep}Omon.sos')
41
- parser.add_argument('-t', '--cmor_tables', type=parse_input_list,
42
- help=f'include only the specified CMOR tables, example: -t Amon{sep}Omon')
48
+ help=dedent(f'''\
49
+ include only variables with the specified compound names, examples:
50
+ -cn Amon.tas{sep}Omon.sos
51
+ -cn atmos.tas.tavg-h2m-hxy-u.mon.glb{sep}ocean.sos.tavg-u-hxy-sea.mon.glb
52
+ uses CMIP7 or CMIP6 compound name, depending on variable_name config parameter (use CMIP7_data_request_api_config to set)
53
+ '''))
43
54
  parser.add_argument('-v', '--cmor_variables', type=parse_input_list,
44
- help=f'include only the specified CMOR variable short names, example: -v tas{sep}siconc')
55
+ help=dedent(f'''\
56
+ include only the specified CMOR variable out_name, example:
57
+ -v tas{sep}siconc
58
+ '''))
59
+ parser.add_argument('-r', '--realms', type=parse_input_list,
60
+ help=dedent(f'''\
61
+ include only the specified realms, examples:
62
+ -r atmos
63
+ -r ocean{sep}ocnBgchem{sep}seaIce
64
+ '''))
65
+ parser.add_argument('-t', '--cmip6_cmor_tables', type=parse_input_list,
66
+ help=dedent(f'''\
67
+ include only the specified CMIP6 CMOR tables, example:
68
+ -t Amon{sep}Omon
69
+ '''))
45
70
 
46
71
  return parser.parse_args()
47
72
 
@@ -69,8 +94,10 @@ def main():
69
94
  content,
70
95
  use_dreq_version,
71
96
  compound_names=args.compound_names,
72
- cmor_tables=args.cmor_tables,
97
+ cmor_tables=args.cmip6_cmor_tables,
73
98
  cmor_variables=args.cmor_variables,
99
+ realms=args.realms,
100
+ attributes=args.attributes,
74
101
  )
75
102
 
76
103
  # Write output file
@@ -1092,7 +1092,7 @@ class DataRequest(object):
1092
1092
 
1093
1093
  def apply_operation_on_requests_links(dict_request_links, elements, operation, void_list="full"):
1094
1094
  logger = get_logger()
1095
- if len(rep) == 0:
1095
+ if len(dict_request_links) == 0:
1096
1096
  if void_list == "full":
1097
1097
  rep_list = set(elements)
1098
1098
  elif void_list == "void":
@@ -709,6 +709,7 @@ def get_requested_variables(content, dreq_version,
709
709
 
710
710
  def get_variables_metadata(content, dreq_version,
711
711
  compound_names=None, cmor_tables=None, cmor_variables=None,
712
+ realms=None, attributes=None,
712
713
  verbose=True):
713
714
  '''
714
715
  Get metadata for CMOR variables (dimensions, cell_methods, out_name, ...).
@@ -727,11 +728,20 @@ def get_variables_metadata(content, dreq_version,
727
728
  Example: ['Amon.tas', 'Omon.sos']
728
729
  cmor_tables : list[str]
729
730
  Names of CMOR tables to include. If not given, all are included.
731
+ At present this refers to CMIP6 CMOR tables.
730
732
  Example: ['Amon', 'Omon']
731
733
  cmor_variables : list[str]
732
734
  Names of CMOR variables to include. If not given, all are included.
733
735
  Here the out_name is used as the CMOR variable name.
734
736
  Example: ['tas', 'siconc']
737
+ realms: list[str]
738
+ Include only variables that include one of the specified realms in their
739
+ list of realms (variables can have more than one realm).
740
+ Example: ['atmos', 'aerosol']
741
+ attributes: list[str]
742
+ Include only the specified metadata attributes.
743
+ The attributes are presented in the order specified by the user.
744
+ Example: ['frequency', 'region', 'modeling_realm']
735
745
 
736
746
  Returns:
737
747
  --------
@@ -788,13 +798,21 @@ def get_variables_metadata(content, dreq_version,
788
798
  dreq_tables['structure'] = base['Structure']
789
799
 
790
800
  # Specify names of some DR variable attributes depending the DR version
791
- # TO DO: is this logic still needed? If so, make it explicitly depend on DR Content version?
792
801
  if 'CMIP6 Table Identifiers (legacy)' in base:
793
- dreq_tables['CMOR tables'] = base['CMIP6 Table Identifiers (legacy)']
802
+ # dreq_tables['CMIP6 CMOR tables'] identifies the table in the DR Airtable that lists CMIP6 CMOR tables.
803
+ dreq_tables['CMIP6 CMOR tables'] = base['CMIP6 Table Identifiers (legacy)']
804
+ # attr_table identifies the CMIP6 CMOR table to which the variable belonged.
805
+ # If the variable did not exist in CMIP6, this is the CMIP6 table name that was assigned to it during CMIP7 DR development.
806
+ # Set it here to correspond to the "CMIP6 Table (legacy)" column in the Variables table of DR Airtable.
794
807
  attr_table = 'cmip6_table_legacy'
808
+ # attr_realm identifies the primary realm of the variable (first realm in its list of realms, if there is more than one).
809
+ # Set it here to correspond to the "Modelling Realm - Primary" column in the Variables table of DR Airtable.
795
810
  attr_realm = 'modelling_realm___primary'
796
811
  elif 'Table Identifiers' in base:
797
- dreq_tables['CMOR tables'] = base['Table Identifiers']
812
+ # This section is for DR versions prior to v1.2 (released Mar 2025).
813
+ # See comments above for explanation of what these things are for.
814
+ assert dreq_version < 'v1.2', f'For DR version {dreq_version}, should not be here'
815
+ dreq_tables['CMIP6 CMOR tables'] = base['Table Identifiers']
798
816
  attr_table = 'table'
799
817
  attr_realm = 'modelling_realm'
800
818
  else:
@@ -817,6 +835,10 @@ def get_variables_metadata(content, dreq_version,
817
835
  print('Retaining only these CMOR variables: ' + ', '.join(sorted(cmor_variables, key=str.lower)))
818
836
  if compound_names:
819
837
  print('Retaining only these compound names: ' + ', '.join(sorted(compound_names, key=str.lower)))
838
+ if realms:
839
+ print('Retaining only these realms: ' + ', '.join(sorted(realms, key=str.lower)))
840
+ if attributes:
841
+ print('Retaining only these attributes: ' + ', '.join(sorted(attributes, key=str.lower)))
820
842
 
821
843
  substitute = {
822
844
  # replacement character(s) : [characters to replace with the replacement character]
@@ -834,7 +856,7 @@ def get_variables_metadata(content, dreq_version,
834
856
  link_table = getattr(var, attr_table)
835
857
  if len(link_table) != 1:
836
858
  raise Exception(f'variable {var_name} should have one table link, found: ' + str(link_table))
837
- table_id = dreq_tables['CMOR tables'].get_record(link_table[0]).name
859
+ table_id = dreq_tables['CMIP6 CMOR tables'].get_record(link_table[0]).name
838
860
  if cmor_tables:
839
861
  # Filter by CMOR table name
840
862
  if table_id not in cmor_tables:
@@ -969,6 +991,9 @@ def get_variables_metadata(content, dreq_version,
969
991
  # Get realm(s)
970
992
  link_realm = getattr(var, attr_realm)
971
993
  modeling_realm = [dreq_tables['realm'].get_record(link).id for link in link_realm]
994
+ # modeling_realm should now be the primary realm, so check the returned list contains only one realm
995
+ if not len(modeling_realm) == 1:
996
+ raise ValueError(f'There should be one primary realm for {var_name}, found: ' + ', '.join(modeling_realm))
972
997
  if hasattr(var, attr_realm_additional):
973
998
  # Add secondary realm(s), if any, to the list
974
999
  link_realm_additional = getattr(var, attr_realm_additional)
@@ -976,6 +1001,10 @@ def get_variables_metadata(content, dreq_version,
976
1001
  # Raise error if any realm is duplicated in the list
977
1002
  if len(modeling_realm) != len(set(modeling_realm)):
978
1003
  raise ValueError(f'Redundant realm(s) found for DR variable {var_name}: {modeling_realm}')
1004
+ if realms:
1005
+ # Exclude variables that don't have any of their realms in list
1006
+ if len(set(modeling_realm).intersection(set(realms))) == 0:
1007
+ continue
979
1008
 
980
1009
  cell_measures = ''
981
1010
  if hasattr(var, 'cell_measures'):
@@ -1038,7 +1067,7 @@ def get_variables_metadata(content, dreq_version,
1038
1067
  if hasattr(var, 'branded_variable_name'):
1039
1068
  branded_variable_name = var.branded_variable_name
1040
1069
 
1041
- variableRootDD, branding_label = None, None
1070
+ variableRootDD, branding_suffix = None, None
1042
1071
 
1043
1072
  # Get variableRootDD, the short variable name used in the branded name
1044
1073
  if hasattr(phys_param, 'variablerootdd'):
@@ -1047,33 +1076,33 @@ def get_variables_metadata(content, dreq_version,
1047
1076
 
1048
1077
  # Get the branding label by parsing the branded variable name
1049
1078
  if branded_variable_name.count('_') == 1:
1050
- s, branding_label = branded_variable_name.split('_')
1079
+ s, branding_suffix = branded_variable_name.split('_')
1051
1080
  if not variableRootDD:
1052
1081
  # Set variableRootDD if it wasn't already defined
1053
1082
  variableRootDD = s
1054
1083
 
1055
- # Handle undefined cases, to ensure variableRootDD and branding_label are not left undefined
1084
+ # Handle undefined cases, to ensure variableRootDD and branding_suffix are not left undefined
1056
1085
  # (any such cases are anticipated to vanish in post-v1.2.2 dreq versions)
1057
1086
  if not variableRootDD:
1058
1087
  variableRootDD = 'None'
1059
- if not branding_label:
1088
+ if not branding_suffix:
1060
1089
  assert var.branded_variable_name_status not in ['Accepted']
1061
1090
  if branded_variable_name.startswith('unknown'):
1062
- branding_label = branded_variable_name
1091
+ branding_suffix = branded_variable_name
1063
1092
  else:
1064
- branding_label = 'None'
1093
+ branding_suffix = 'None'
1065
1094
 
1066
1095
  check_branded_name = False
1067
1096
  if check_branded_name:
1068
1097
  # Consistency check on definition of branded name.
1069
1098
  # For development, not intended as a user option.
1070
- if branded_variable_name != f'{variableRootDD}_{branding_label}':
1099
+ if branded_variable_name != f'{variableRootDD}_{branding_suffix}':
1071
1100
  warnings.warn(f'Inconsistency between branded variable name {branded_variable_name} '
1072
- + f'and its components: {variableRootDD}, {branding_label}')
1101
+ + f'and its components: {variableRootDD}, {branding_suffix}')
1073
1102
 
1074
1103
  var_info.update({
1075
1104
  'variableRootDD': variableRootDD,
1076
- 'branding_label': branding_label,
1105
+ 'branding_suffix': branding_suffix,
1077
1106
  'branded_variable_name': branded_variable_name,
1078
1107
  })
1079
1108
 
@@ -1095,7 +1124,7 @@ def get_variables_metadata(content, dreq_version,
1095
1124
  cn = []
1096
1125
  cn.append(modeling_realm[0])
1097
1126
  cn.append(variableRootDD)
1098
- cn.append(branding_label)
1127
+ cn.append(branding_suffix)
1099
1128
  cn.append(frequency)
1100
1129
  cn.append(var_info['region'])
1101
1130
  sep = '.'
@@ -1122,6 +1151,9 @@ def get_variables_metadata(content, dreq_version,
1122
1151
  v = v.replace(s, replacement)
1123
1152
  var_info[k] = v
1124
1153
 
1154
+ if attributes:
1155
+ var_info = OrderedDict({attr: var_info[attr] for attr in attributes})
1156
+
1125
1157
  assert var_name not in all_var_info, 'non-unique variable name: ' + var_name
1126
1158
  all_var_info[var_name] = var_info
1127
1159
 
@@ -1353,9 +1385,7 @@ def write_variables_metadata(all_var_info, dreq_version, filepath,
1353
1385
  # Write variables metadata to csv
1354
1386
  var_info = next(iter(all_var_info.values()))
1355
1387
  attrs = list(var_info.keys())
1356
- columns = ['Compound Name']
1357
- columns.append('standard_name')
1358
- columns.append('standard_name_proposed')
1388
+ columns = ['Compound Name'] # compound name is always the first column
1359
1389
  columns += [s for s in attrs if s not in columns]
1360
1390
  rows = [columns] # column header line
1361
1391
  # Add each variable as a row
@@ -240,6 +240,9 @@ class ConstantValueObj(object):
240
240
  def __str__(self):
241
241
  return str(self.value)
242
242
 
243
+ def __repr__(self):
244
+ return str(self)
245
+
243
246
  def __hash__(self):
244
247
  return hash(self.value)
245
248
 
@@ -83,7 +83,7 @@ def test_apply_consistency_fixes():
83
83
  assert varfield_dropped != []
84
84
  # Read 1-base export and select certain tables
85
85
  one_base_input = read_json_file(filepath("dreq_release_export.json"))[
86
- "Data Request v1.2.2"
86
+ "Data Request v1.2.2.3"
87
87
  ]
88
88
  selected_tables = [
89
89
  "Variables",