pycontrails 0.49.3__tar.gz → 0.49.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.

Potentially problematic release.


This version of pycontrails might be problematic. Click here for more details.

Files changed (247) hide show
  1. {pycontrails-0.49.3 → pycontrails-0.49.5}/CHANGELOG.md +39 -0
  2. {pycontrails-0.49.3 → pycontrails-0.49.5}/Makefile +3 -3
  3. {pycontrails-0.49.3/pycontrails.egg-info → pycontrails-0.49.5}/PKG-INFO +2 -2
  4. pycontrails-0.49.5/docs/_static/img/colab.png +0 -0
  5. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/api.rst +10 -2
  6. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/develop.rst +15 -15
  7. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/GFS.ipynb +1 -1
  8. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks.rst +38 -3
  9. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/_version.py +2 -2
  10. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/datalib.py +1 -1
  11. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/flight.py +11 -11
  12. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/interpolation.py +29 -19
  13. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/met.py +192 -104
  14. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/models.py +29 -15
  15. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/rgi_cython.c +125 -125
  16. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/vector.py +14 -15
  17. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/gfs/gfs.py +1 -1
  18. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/spire/spire.py +23 -19
  19. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/ext/synthetic_flight.py +3 -1
  20. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/accf.py +6 -4
  21. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/cocip.py +48 -18
  22. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/cocip_params.py +13 -10
  23. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/output_formats.py +62 -52
  24. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocipgrid/cocip_grid.py +459 -275
  25. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocipgrid/cocip_grid_params.py +12 -18
  26. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/ffm2.py +10 -8
  27. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/pcc.py +1 -1
  28. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/ps_model/ps_aircraft_params.py +1 -1
  29. pycontrails-0.49.3/pycontrails/models/ps_model/static/ps-aircraft-params-20231117.csv → pycontrails-0.49.5/pycontrails/models/ps_model/static/ps-aircraft-params-20240209.csv +12 -3
  30. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/utils/json.py +12 -10
  31. {pycontrails-0.49.3 → pycontrails-0.49.5/pycontrails.egg-info}/PKG-INFO +2 -2
  32. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails.egg-info/SOURCES.txt +2 -2
  33. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails.egg-info/requires.txt +1 -1
  34. {pycontrails-0.49.3 → pycontrails-0.49.5}/pyproject.toml +4 -3
  35. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/conftest.py +21 -6
  36. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_cocip.py +164 -2
  37. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_cocip_grid.py +92 -106
  38. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_fleet.py +12 -10
  39. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_flight.py +39 -23
  40. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_fuel.py +1 -1
  41. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_interpolation.py +10 -8
  42. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_met.py +11 -8
  43. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_models.py +2 -2
  44. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_ps_model.py +3 -3
  45. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_sac_issr.py +6 -4
  46. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_vector.py +21 -14
  47. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_zarr.py +1 -1
  48. pycontrails-0.49.3/pycontrails/models/cocipgrid/cocip_time_handling.py +0 -342
  49. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  50. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  51. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/dependabot.yaml +0 -0
  52. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/pull_request_template.md +0 -0
  53. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/workflows/benchmark.yaml +0 -0
  54. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/workflows/docs.yaml +0 -0
  55. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/workflows/doctest.yaml +0 -0
  56. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/workflows/release.yaml +0 -0
  57. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/workflows/scorecard.yaml +0 -0
  58. {pycontrails-0.49.3 → pycontrails-0.49.5}/.github/workflows/test.yaml +0 -0
  59. {pycontrails-0.49.3 → pycontrails-0.49.5}/.gitignore +0 -0
  60. {pycontrails-0.49.3 → pycontrails-0.49.5}/.pre-commit-config.yaml +0 -0
  61. {pycontrails-0.49.3 → pycontrails-0.49.5}/.zenodo.json +0 -0
  62. {pycontrails-0.49.3 → pycontrails-0.49.5}/CONTRIBUTING.md +0 -0
  63. {pycontrails-0.49.3 → pycontrails-0.49.5}/LICENSE +0 -0
  64. {pycontrails-0.49.3 → pycontrails-0.49.5}/NOTICE +0 -0
  65. {pycontrails-0.49.3 → pycontrails-0.49.5}/README.md +0 -0
  66. {pycontrails-0.49.3 → pycontrails-0.49.5}/RELEASE.md +0 -0
  67. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/_static/css/style.css +0 -0
  68. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/_static/img/favicon.png +0 -0
  69. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/_static/img/logo-dark.png +0 -0
  70. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/_static/img/logo.png +0 -0
  71. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/_static/pycontrails.bib +0 -0
  72. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/changelog.rst +0 -0
  73. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/conf.py +0 -0
  74. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/contributing.rst +0 -0
  75. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/flight.rst +0 -0
  76. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/index.rst +0 -0
  77. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/install.rst +0 -0
  78. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/integrations/ACCF.ipynb +0 -0
  79. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/literature.rst +0 -0
  80. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/meteorology.rst +0 -0
  81. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/models.rst +0 -0
  82. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/AircraftPerformance.ipynb +0 -0
  83. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/Cache.ipynb +0 -0
  84. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/CoCiP.ipynb +0 -0
  85. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/ECMWF.ipynb +0 -0
  86. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/Flight.ipynb +0 -0
  87. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/GOES.ipynb +0 -0
  88. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/ISSR.ipynb +0 -0
  89. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/Meteorology.ipynb +0 -0
  90. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/SAC.ipynb +0 -0
  91. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/advection.ipynb +0 -0
  92. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/airports.ipynb +0 -0
  93. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/data/.gitignore +0 -0
  94. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/data/flight-ap.csv +0 -0
  95. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/data/flight-cocip.csv +0 -0
  96. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/data/flight-fdr.csv +0 -0
  97. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/data/flight-noisy.csv +0 -0
  98. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/data/flight.csv +0 -0
  99. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/flightplan.ipynb +0 -0
  100. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/model-levels.ipynb +0 -0
  101. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/run-cocip-on-flight.ipynb +0 -0
  102. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/run-cocip-with-fdr.ipynb +0 -0
  103. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/notebooks/specific-humidity-interpolation.ipynb +0 -0
  104. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/observations.rst +0 -0
  105. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/tutorials.rst +0 -0
  106. {pycontrails-0.49.3 → pycontrails-0.49.5}/docs/utilities.rst +0 -0
  107. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/__init__.py +0 -0
  108. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/__init__.py +0 -0
  109. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/aircraft_performance.py +0 -0
  110. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/airports.py +0 -0
  111. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/cache.py +0 -0
  112. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/coordinates.py +0 -0
  113. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/fleet.py +0 -0
  114. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/flightplan.py +0 -0
  115. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/fuel.py +0 -0
  116. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/met_var.py +0 -0
  117. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/polygon.py +0 -0
  118. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/core/rgi_cython.pyx +0 -0
  119. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/__init__.py +0 -0
  120. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/ecmwf/__init__.py +0 -0
  121. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/ecmwf/common.py +0 -0
  122. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/ecmwf/era5.py +0 -0
  123. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/ecmwf/hres.py +0 -0
  124. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/ecmwf/ifs.py +0 -0
  125. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/ecmwf/variables.py +0 -0
  126. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/gfs/__init__.py +0 -0
  127. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/gfs/variables.py +0 -0
  128. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/goes.py +0 -0
  129. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/datalib/spire/__init__.py +0 -0
  130. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/ext/bada.py +0 -0
  131. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/ext/cirium.py +0 -0
  132. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/ext/empirical_grid.py +0 -0
  133. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/__init__.py +0 -0
  134. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/__init__.py +0 -0
  135. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/cocip_uncertainty.py +0 -0
  136. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/contrail_properties.py +0 -0
  137. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/radiative_forcing.py +0 -0
  138. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/radiative_heating.py +0 -0
  139. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/wake_vortex.py +0 -0
  140. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocip/wind_shear.py +0 -0
  141. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/cocipgrid/__init__.py +0 -0
  142. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/dry_advection.py +0 -0
  143. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/__init__.py +0 -0
  144. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/black_carbon.py +0 -0
  145. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/emissions.py +0 -0
  146. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/static/default-engine-uids.csv +0 -0
  147. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/static/edb-gaseous-v28c-engines.csv +0 -0
  148. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/emissions/static/edb-nvpm-v28c-engines.csv +0 -0
  149. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/humidity_scaling/__init__.py +0 -0
  150. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/humidity_scaling/humidity_scaling.py +0 -0
  151. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/humidity_scaling/quantiles/era5-quantiles.pq +0 -0
  152. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/issr.py +0 -0
  153. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/pcr.py +0 -0
  154. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/ps_model/__init__.py +0 -0
  155. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/ps_model/ps_grid.py +0 -0
  156. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/ps_model/ps_model.py +0 -0
  157. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/ps_model/ps_operational_limits.py +0 -0
  158. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/sac.py +0 -0
  159. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/models/tau_cirrus.py +0 -0
  160. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/physics/__init__.py +0 -0
  161. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/physics/constants.py +0 -0
  162. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/physics/geo.py +0 -0
  163. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/physics/jet.py +0 -0
  164. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/physics/thermo.py +0 -0
  165. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/physics/units.py +0 -0
  166. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/py.typed +0 -0
  167. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/utils/__init__.py +0 -0
  168. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/utils/dependencies.py +0 -0
  169. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/utils/iteration.py +0 -0
  170. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/utils/temp.py +0 -0
  171. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails/utils/types.py +0 -0
  172. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails.egg-info/dependency_links.txt +0 -0
  173. {pycontrails-0.49.3 → pycontrails-0.49.5}/pycontrails.egg-info/top_level.txt +0 -0
  174. {pycontrails-0.49.3 → pycontrails-0.49.5}/setup.cfg +0 -0
  175. {pycontrails-0.49.3 → pycontrails-0.49.5}/setup.py +0 -0
  176. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/__init__.py +0 -0
  177. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/_deprecated.py +0 -0
  178. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/Makefile +0 -0
  179. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/README.md +0 -0
  180. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/benchmark.py +0 -0
  181. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/compare.py +0 -0
  182. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/data.md +0 -0
  183. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/output.py +0 -0
  184. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip/review.ipynb +0 -0
  185. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/cocip-fortran/README.md +0 -0
  186. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/north-atlantic-study/.gcloudignore +0 -0
  187. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/north-atlantic-study/README.md +0 -0
  188. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/north-atlantic-study/support.py +0 -0
  189. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/benchmark/north-atlantic-study/validate.py +0 -0
  190. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/fixtures/cocip-met.py +0 -0
  191. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/fixtures/cocip-met2.py +0 -0
  192. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/fixtures/ecmwf-met.py +0 -0
  193. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/fixtures/gfs-met.py +0 -0
  194. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/__init__.py +0 -0
  195. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/NOAA_Solar_Calculations_day.csv +0 -0
  196. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/cocip-contrail-output.json +0 -0
  197. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/cocip-contrail-output2.json +0 -0
  198. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/cocip-flight-output.json +0 -0
  199. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/cocip-flight-output2.json +0 -0
  200. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/cocip-output-contrail-edges.json +0 -0
  201. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/cocip-output-flts-20190101-eu.pq +0 -0
  202. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/flight-cocip2.csv +0 -0
  203. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/flight-meridian.csv +0 -0
  204. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/flight-metadata.json +0 -0
  205. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/flight-spire-data-cleaning.pq +0 -0
  206. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/flight.csv +0 -0
  207. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/flt-wypts-20190101-eu.pq +0 -0
  208. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-20190101-eu.nc +0 -0
  209. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-accf-pl.nc +0 -0
  210. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-accf-sl.nc +0 -0
  211. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-ecmwf-pl.nc +0 -0
  212. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-ecmwf-sl.nc +0 -0
  213. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-era5-cocip1.nc +0 -0
  214. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-era5-cocip2.nc +0 -0
  215. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/met-gfs.nc +0 -0
  216. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/polygon-bug.nc +0 -0
  217. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/rad-20190101-eu.nc +0 -0
  218. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/rad-era5-cocip1.nc +0 -0
  219. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/rad-era5-cocip2.nc +0 -0
  220. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/static/rad-gfs.nc +0 -0
  221. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_accf.py +0 -0
  222. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_airports.py +0 -0
  223. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_cache.py +0 -0
  224. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_cocip_grid_parity.py +0 -0
  225. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_cocip_radiative_forcing.py +0 -0
  226. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_cocip_uncertainty.py +0 -0
  227. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_coordinates.py +0 -0
  228. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_datalib.py +0 -0
  229. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_dry_advection.py +0 -0
  230. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_dtypes.py +0 -0
  231. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_ecmwf.py +0 -0
  232. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_emissions.py +0 -0
  233. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_flightplan.py +0 -0
  234. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_geo.py +0 -0
  235. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_gfs.py +0 -0
  236. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_goes.py +0 -0
  237. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_grid_to_netcdf.py +0 -0
  238. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_humidity_scaling.py +0 -0
  239. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_init.py +0 -0
  240. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_met_cache.py +0 -0
  241. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_pcc.py +0 -0
  242. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_polygons.py +0 -0
  243. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_spire.py +0 -0
  244. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_tau_cirrus.py +0 -0
  245. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_thermo_sac.py +0 -0
  246. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_units.py +0 -0
  247. {pycontrails-0.49.3 → pycontrails-0.49.5}/tests/unit/test_utils.py +0 -0
@@ -1,6 +1,45 @@
1
1
 
2
2
  # Changelog
3
3
 
4
+ ## v0.49.5
5
+
6
+ ## Fixes
7
+
8
+ - Fix bug where `Cocip._process_rad` lost radiation dataset attributes
9
+
10
+ ## v0.49.4
11
+
12
+ ### Breaking changes
13
+
14
+ - Remove the `CocipGridParams.met_slice_dt` parameter. Now met downselection is handled automatically during contrail evolution. When the `met` and `rad` data passed into `CocipGrid` are not already loaded into memory, this update may make `CocipGrid` slightly more performant.
15
+ - No longer explicitly load `met` and `rad` time slices into memory in `CocipGrid`. This now only occurs downstream when interpolation is performed. This change better aligns `CocipGrid` with other pycontrails models.
16
+ - Remove the `cocipgrid.cocip_time_handling` module. Any useful tooling has been moved directly to the `cocipgrid.cocip_grid` module.
17
+ - Remove the `CocipGrid.timedict` attribute. Add a `CocipGrid.timesteps` attribute. This is now applied in the same manner that the `Cocip` model uses its `timesteps` attribute.
18
+ - Simplify the runtime estimate used in constructing the `CocipGrid` `tqdm` progress bar. The new estimate is less precise than the previous estimate and should not be trusted for long-running simulations.
19
+ - Deprecate `MetBase.variables` in favor of `MetBase.indexes`.
20
+
21
+ ### Features
22
+
23
+ - Add support for 9 additional aircraft types in the [Poll-Schumann](https://py.contrails.org/notebooks/AircraftPerformance.html) (PS) aircraft performance model. The new aircraft types are:
24
+ - A338
25
+ - A339
26
+ - A35K
27
+ - B37M
28
+ - B38M
29
+ - B39M
30
+ - B78X
31
+ - BCS1
32
+ - BCS3
33
+ - Modify PS coefficients for B788, B789, and A359.
34
+ - Support running `CocipGrid` on meteorology data without a uniformly-spaced time dimension. The `CocipGrid` implementation now no longer assumes `met["time"].diff()` is constant.
35
+ - Add a `MetDataset.downselect_met` method. This performs a met downselection in analogy with `GeoVectorDataset.downselect_met`.
36
+
37
+ ### Fixes
38
+
39
+ - Improve clarity of warnings produced when meteorology data doesn't cover the time range required by a gridded CoCiP model.
40
+ - No longer emit `pandas` warning when `Flight.resample_and_fill(..., drop=True, ...)` is called with non-float data.
41
+ - Correctly handle `CocipGrid` `rad` data with non-uniform time steps.
42
+
4
43
  ## v0.49.3
5
44
 
6
45
  ### Features
@@ -21,8 +21,8 @@ END_COLOR = \033[0m
21
21
  # the latest open3d and accf packages often don't support the latest
22
22
  # versions of python
23
23
  pip-install:
24
- pip install -U pip wheel
25
- pip install -e ".[complete]"
24
+ python -m pip install -U pip wheel
25
+ python -m pip install -e ".[complete]"
26
26
 
27
27
  # these still must be installed manually for Python < 3.10
28
28
  # -pip install -e ".[open3d]"
@@ -30,7 +30,7 @@ pip-install:
30
30
  # development installation
31
31
  dev-install: pip-install
32
32
 
33
- pip install -e ".[dev,docs]"
33
+ python -m pip install -e ".[dev,docs]"
34
34
 
35
35
  # install pre-commit
36
36
  pre-commit install
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycontrails
3
- Version: 0.49.3
3
+ Version: 0.49.5
4
4
  Summary: Python library for modeling aviation climate impacts
5
5
  Author-email: Breakthrough Energy <py@contrails.org>
6
6
  License: Apache-2.0
@@ -36,7 +36,7 @@ Requires-Dist: xarray>=2022.3
36
36
  Provides-Extra: complete
37
37
  Requires-Dist: pycontrails[ecmwf,gcp,gfs,goes,jupyter,pyproj,vis,zarr]; extra == "complete"
38
38
  Provides-Extra: dev
39
- Requires-Dist: black[jupyter]==24.1.1; extra == "dev"
39
+ Requires-Dist: black[jupyter]==24.2.0; extra == "dev"
40
40
  Requires-Dist: dep_license; extra == "dev"
41
41
  Requires-Dist: fastparquet>=0.8; extra == "dev"
42
42
  Requires-Dist: ipdb>=0.13; extra == "dev"
@@ -118,6 +118,16 @@ CoCiP
118
118
  models.cocip.wind_shear
119
119
 
120
120
 
121
+ Gridded CoCiP
122
+ """""""""""""
123
+
124
+ .. autosummary::
125
+ :toctree: api/
126
+
127
+ models.cocipgrid.CocipGrid
128
+ models.cocipgrid.CocipGridParams
129
+
130
+
121
131
  ACCF
122
132
  """"
123
133
 
@@ -134,8 +144,6 @@ ACCF
134
144
  Aircraft Performance
135
145
  """"""""""""""""""""
136
146
 
137
- *In development*
138
-
139
147
  .. autosummary::
140
148
  :toctree: api/
141
149
 
@@ -34,7 +34,7 @@ Python, create a dedicated Anaconda environment:
34
34
  .. code-block:: bash
35
35
 
36
36
  # create conda environment
37
- $ conda create -n contrails python=3.10
37
+ $ conda create -n contrails
38
38
 
39
39
  # activate environment
40
40
  $ conda activate contrails
@@ -132,10 +132,10 @@ Notebook validation and doctests require `Copernicus Climate Data Store (CDS) cr
132
132
  Documentation
133
133
  -------------
134
134
 
135
- Documentation is written in `reStructuredText <https://docutils.sourceforge.io/rst.html>`__
135
+ Documentation is written in `reStructuredText (rst) <https://docutils.sourceforge.io/rst.html>`__
136
136
  and built with `Sphinx <https://www.sphinx-doc.org/en/master/>`__. The `quick reStructuredText
137
137
  reference <https://docutils.sourceforge.io/docs/user/rst/quickref.html>`__
138
- provides a basic overview.
138
+ provides a decent rst syntax overview.
139
139
 
140
140
  Sphinx includes many additional
141
141
  `roles <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`__,
@@ -145,7 +145,7 @@ and
145
145
  to enhance documentation.
146
146
 
147
147
  Sphinx configuration is written in `docs/conf.py <https://github.com/contrailcirrus/pycontrails/blob/main/docs/conf.py>`__.
148
- See `Sphinx configuration docs <https://www.sphinx-doc.org/en/master/usage/configuration.html>`__ for the full list of configuration options.
148
+ See the `Sphinx configuration docs <https://www.sphinx-doc.org/en/master/usage/configuration.html>`__ for the full list of configuration options.
149
149
 
150
150
  Build HTML documentation:
151
151
 
@@ -227,17 +227,17 @@ To build manually, run:
227
227
  References
228
228
  ~~~~~~~~~~
229
229
 
230
+ Literature references managed in the `pycontrails Zotero library <https://www.zotero.org/groups/4730892/pycontrails/library>`__.
231
+
230
232
  The documentation uses
231
233
  `sphinxcontrib-bibtex <https://sphinxcontrib-bibtex.readthedocs.io/en/latest/usage.html>`__
232
234
  to include citations and a bibliography.
233
235
 
234
236
  All references should be cited through documentation and docstrings
235
- using the ```:cite:``
236
- directive <https://sphinxcontrib-bibtex.readthedocs.io/en/latest/usage.html#role-cite>`__.
237
+ using the `:cite: role <https://sphinxcontrib-bibtex.readthedocs.io/en/latest/usage.html#role-cite>`__.
237
238
 
238
- Literature references managed in the `pycontrails Zotero library <https://www.zotero.org/groups/4730892/pycontrails/library>`__.
239
239
 
240
- To automatically sync this library with the
240
+ To automatically sync the Zotero library with the
241
241
  `docs/_static/pycontrails.bib <https://github.com/contrailcirrus/pycontrails/blob/main/docs/_static/pycontrails.bib>`__ Bibtex file:
242
242
 
243
243
  - Install `Zotero <https://www.zotero.org/>`__ and add the `pycontrails library <https://www.zotero.org/groups/4730892/pycontrails/library>`__.
@@ -277,10 +277,10 @@ Test notebook examples with `nbval pytest plugin <https://github.com/computation
277
277
 
278
278
 
279
279
  Conventions
280
- ===========
280
+ -----------
281
281
 
282
282
  Code
283
- ----
283
+ ~~~~
284
284
 
285
285
  ``pycontrails`` aims to implement clear, consistent, performant data
286
286
  structures and models.
@@ -297,8 +297,7 @@ pre-commit hook.
297
297
  The project uses `pytest <https://docs.pytest.org/en/7.2.x/>`__ to run
298
298
  unit tests. New code should include clear unit tests for implementation
299
299
  and output values. New test files should be included in the
300
- ```/tests/unit/``
301
- directory <https://github.com/contrailcirrus/pycontrails/tree/main/tests/unit>`__.
300
+ `/tests/unit/ directory <https://github.com/contrailcirrus/pycontrails/tree/main/tests/unit>`__.
302
301
 
303
302
  The project uses `Github
304
303
  Actions <https://github.com/contrailcirrus/pycontrails/actions>`__ to
@@ -310,7 +309,7 @@ before pushing using:
310
309
  $ make test
311
310
 
312
311
  Docstrings
313
- ----------
312
+ ~~~~~~~~~~
314
313
 
315
314
  Wherever possible, we adhere to the `NumPy docstring
316
315
  conventions <https://numpydoc.readthedocs.io/en/latest/format.html>`__.
@@ -333,7 +332,7 @@ General guidelines:
333
332
  Variable, module, function, and class names
334
333
  should be written between single back-ticks (`numpy`).
335
334
 
336
- When you specify a type in **Parameters** or **See Also**, Sphinx will
335
+ When specifying types in **Parameters** or **See Also**, Sphinx will
337
336
  automatically replace the text with the ``napolean_type_aliases``
338
337
  specified in
339
338
  `conf.py <https://github.com/contrailcirrus/pycontrails/blob/main/docs/conf.py>`__,
@@ -364,7 +363,8 @@ The **See Also** section is *not a list*. All of the following work:
364
363
 
365
364
  When you specify a type outside of **Parameters**, you have to use the
366
365
  `sphinx cross-referencing
367
- syntax <https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects>`__:
366
+ syntax <https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects>`__
367
+ with the full module name:
368
368
 
369
369
  .. code:: python
370
370
 
@@ -796,7 +796,7 @@
796
796
  "source": [
797
797
  "## Run CoCiP with GFS\n",
798
798
  "\n",
799
- "See the [CoCiP Notebook](https://py.contrails.org/examples/CoCiP.html) for more details on running the CoCiP model."
799
+ "See the [CoCiP Notebook](https://py.contrails.org/notebooks/CoCiP.html) for more details on running the CoCiP model."
800
800
  ]
801
801
  },
802
802
  {
@@ -4,18 +4,53 @@
4
4
  Running Notebooks
5
5
  =================
6
6
 
7
- The `/docs <https://github.com/contrailcirrus/pycontrails/tree/main/docs>`__
7
+ The `/docs/notebooks <https://github.com/contrailcirrus/pycontrails/tree/main/docs/notebooks>`__
8
8
  directory in the repository contains `Jupyter Notebooks <https://jupyter.org/>`__
9
9
  demonstrating ``pycontrails``.
10
10
 
11
- To run these notebooks interactively, clone or download the repository,
11
+ Local
12
+ -----
13
+
14
+ To run these notebooks locally, clone or download the repository,
12
15
  enter the ``docs`` directory, and launch ``jupyter lab``:
13
16
 
14
17
  .. code:: bash
15
18
 
16
19
  $ git clone https://github.com/contrailcirrus/pycontrails.git
17
20
  $ cd pycontrails/docs
18
- $ jupyter lab
21
+ $ jupyter lab # or notebook
22
+
23
+ If you don't have `Jupyter installed <https://jupyter.org/install>`__,
24
+ install the optional ``pycontrails[jupyter]`` dependencies:
25
+
26
+ .. code-block:: bash
27
+
28
+ $ pip install "pycontrails[jupyter]" # Jupyter notebook and lab interface
29
+
30
+ Colab
31
+ -----
32
+
33
+ Notebooks can also be opened in `Google Colab <https://colab.research.google.com>`__.
34
+ Select *File* -> *Open* -> **Github**, enter ``contrailcirrus/pycontrails``, then
35
+ select the Notebook to open.
36
+
37
+ .. image:: _static/img/colab.png
38
+ :alt: Colab example
39
+
40
+ Alternatively, any notebook directly with the url ``https://colab.research.google.com/github/``
41
+ + the path to the notebook file on github.com
42
+ (e.g. `CoCiP.ipynb
43
+ <https://colab.research.google.com/github/contrailcirrus/pycontrails/blob/main/docs/notebooks/CoCiP.ipynb>`__)
44
+
45
+ ``pycontrails`` must be installed into Colab environment by adding the top cell:
46
+
47
+ .. code:: bash
48
+
49
+ !pip install pycontrails
50
+
51
+ Credentials and data must be added to each Colab environment.
52
+ Colab integrates with Google Drive to `load and save data <https://colab.research.google.com/notebooks/io.ipynb>`__
53
+ and `store secrets <https://medium.com/@parthdasawant/how-to-use-secrets-in-google-colab-450c38e3ec75>`__.
19
54
 
20
55
  Data
21
56
  ----
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.49.3'
16
- __version_tuple__ = version_tuple = (0, 49, 3)
15
+ __version__ = version = '0.49.5'
16
+ __version_tuple__ = version_tuple = (0, 49, 5)
@@ -353,7 +353,7 @@ class MetDataSource(abc.ABC):
353
353
  self,
354
354
  time: TimeInput | None,
355
355
  variables: VariableInput,
356
- pressure_levels: PressureLevelInput = [-1],
356
+ pressure_levels: PressureLevelInput = -1,
357
357
  paths: str | list[str] | pathlib.Path | list[pathlib.Path] | None = None,
358
358
  grid: float | None = None,
359
359
  **kwargs: Any,
@@ -936,8 +936,7 @@ class Flight(GeoVectorDataset):
936
936
 
937
937
  # Remove original index if requested
938
938
  if not keep_original_index:
939
- filt = df.index.isin(t)
940
- df = df.loc[filt]
939
+ df = df.loc[t]
941
940
 
942
941
  # finally reset index
943
942
  df = df.reset_index()
@@ -1200,11 +1199,13 @@ class Flight(GeoVectorDataset):
1200
1199
  dict[str, Any]
1201
1200
  Python representation of geojson FeatureCollection
1202
1201
  """
1203
- points = _return_linestring({
1204
- "longitude": self["longitude"],
1205
- "latitude": self["latitude"],
1206
- "altitude": self.altitude,
1207
- })
1202
+ points = _return_linestring(
1203
+ {
1204
+ "longitude": self["longitude"],
1205
+ "latitude": self["latitude"],
1206
+ "altitude": self.altitude,
1207
+ }
1208
+ )
1208
1209
  geometry = {"type": "LineString", "coordinates": points}
1209
1210
  properties = {
1210
1211
  "start_time": self.time_start.isoformat(),
@@ -2041,7 +2042,7 @@ def _resample_to_freq(df: pd.DataFrame, freq: str) -> tuple[pd.DataFrame, pd.Dat
2041
2042
  """Resample a DataFrame to a given frequency.
2042
2043
 
2043
2044
  This function is used to resample a DataFrame to a given frequency. The new
2044
- index will include all the original index values and the new esampled-to-freq
2045
+ index will include all the original index values and the new resampled-to-freq
2045
2046
  index values. The "longitude" and "latitude" columns will be linearly interpolated
2046
2047
  to the new index values.
2047
2048
 
@@ -2064,7 +2065,7 @@ def _resample_to_freq(df: pd.DataFrame, freq: str) -> tuple[pd.DataFrame, pd.Dat
2064
2065
  # and the resampled-to-freq index values.
2065
2066
  t0 = df.index[0]
2066
2067
  t1 = df.index[-1]
2067
- t = pd.date_range(t0, t1, freq=freq).floor(freq)
2068
+ t = pd.date_range(t0, t1, freq=freq, name="time").floor(freq)
2068
2069
  if t[0] < t0:
2069
2070
  t = t[1:]
2070
2071
 
@@ -2072,8 +2073,7 @@ def _resample_to_freq(df: pd.DataFrame, freq: str) -> tuple[pd.DataFrame, pd.Dat
2072
2073
  concat_arr = np.unique(concat_arr)
2073
2074
  concat_index = pd.DatetimeIndex(concat_arr, name="time", copy=False)
2074
2075
 
2075
- out = pd.DataFrame(index=concat_index, columns=df.columns, dtype=float)
2076
- out.loc[df.index] = df
2076
+ out = df.reindex(concat_index)
2077
2077
 
2078
2078
  # Linearly interpolate small horizontal gap
2079
2079
  coords = ["longitude", "latitude"]
@@ -66,7 +66,8 @@ class PycontrailsRegularGridInterpolator(scipy.interpolate.RegularGridInterpolat
66
66
  fill_value: float | np.float64 | None,
67
67
  ):
68
68
  if values.dtype not in (np.float32, np.float64):
69
- raise ValueError("values must be a float array")
69
+ msg = f"values must be a float array, not {values.dtype}"
70
+ raise ValueError(msg)
70
71
 
71
72
  self.grid = points
72
73
  self.values = values
@@ -94,7 +95,8 @@ class PycontrailsRegularGridInterpolator(scipy.interpolate.RegularGridInterpolat
94
95
  g0 = self.grid[i][0]
95
96
  g1 = self.grid[i][-1]
96
97
  if not (np.all(p >= g0) and np.all(p <= g1)):
97
- raise ValueError(f"One of the requested xi is out of bounds in dimension {i}")
98
+ msg = f"One of the requested xi is out of bounds in dimension {i}"
99
+ raise ValueError(msg)
98
100
 
99
101
  return np.zeros(xi.shape[0], dtype=bool)
100
102
 
@@ -213,7 +215,8 @@ class PycontrailsRegularGridInterpolator(scipy.interpolate.RegularGridInterpolat
213
215
  # np.interp could be better ... although that may also promote the dtype
214
216
  return rgi_cython.evaluate_linear_1d(values, indices, norm_distances, out)
215
217
 
216
- raise ValueError(f"Invalid number of dimensions: {ndim}")
218
+ msg = f"Invalid number of dimensions: {ndim}"
219
+ raise ValueError(msg)
217
220
 
218
221
 
219
222
  def _floatize_time(
@@ -442,18 +445,16 @@ def interp(
442
445
  coords = {"longitude": longitude, "latitude": latitude, "level": level, "time": time}
443
446
  da = _localize(da, coords)
444
447
 
445
- # Using da.coords.variables is slightly more performant than da["longitude"].values
446
- variables = da.coords.variables
447
- x = variables["longitude"].values
448
- y = variables["latitude"].values
449
- z = variables["level"].values
448
+ indexes = da._indexes
449
+ x = indexes["longitude"].index.to_numpy() # type: ignore[attr-defined]
450
+ y = indexes["latitude"].index.to_numpy() # type: ignore[attr-defined]
451
+ z = indexes["level"].index.to_numpy() # type: ignore[attr-defined]
450
452
  if any(v.dtype != np.float64 for v in (x, y, z)):
451
- raise ValueError(
452
- "da must have float64 dtype for longitude, latitude, and level coordinates"
453
- )
453
+ msg = "da must have float64 dtype for longitude, latitude, and level coordinates"
454
+ raise ValueError(msg)
454
455
 
455
456
  # Convert t and time to float64
456
- t = variables["time"].values
457
+ t = indexes["time"].index.to_numpy() # type: ignore[attr-defined]
457
458
  offset = t[0]
458
459
  t = _floatize_time(t, offset)
459
460
 
@@ -526,9 +527,11 @@ def _linear_interp_with_indices(
526
527
  indices: RGIArtifacts | None,
527
528
  ) -> tuple[npt.NDArray[np.float64], RGIArtifacts]:
528
529
  if interp.method != "linear":
529
- raise ValueError("Parameter 'indices' is only supported for 'method=linear'")
530
+ msg = "Parameter 'indices' is only supported for 'method=linear'"
531
+ raise ValueError(msg)
530
532
  if localize:
531
- raise ValueError("Parameter 'indices' is only supported for 'localize=False'")
533
+ msg = "Parameter 'indices' is only supported for 'localize=False'"
534
+ raise ValueError(msg)
532
535
 
533
536
  if indices is None:
534
537
  assert xi is not None, "xi must be provided if indices is None"
@@ -604,7 +607,10 @@ class EmissionsProfileInterpolator:
604
607
  """
605
608
 
606
609
  def __init__(
607
- self, xp: npt.NDArray[np.float64], fp: npt.NDArray[np.float64], drop_duplicates: bool = True
610
+ self,
611
+ xp: npt.NDArray[np.float64],
612
+ fp: npt.NDArray[np.float64],
613
+ drop_duplicates: bool = True,
608
614
  ) -> None:
609
615
  if drop_duplicates:
610
616
  # Using np.diff to detect duplicates ... this assumes xp is sorted.
@@ -622,13 +628,17 @@ class EmissionsProfileInterpolator:
622
628
 
623
629
  def _validate(self) -> None:
624
630
  if not len(self.xp):
625
- raise ValueError("xp must not be empty")
631
+ msg = "xp must not be empty"
632
+ raise ValueError(msg)
626
633
  if len(self.xp) != len(self.fp):
627
- raise ValueError("xp and fp must have the same length")
634
+ msg = "xp and fp must have the same length"
635
+ raise ValueError(msg)
628
636
  if not np.all(np.diff(self.xp) > 0.0):
629
- raise ValueError("xp must be strictly increasing")
637
+ msg = "xp must be strictly increasing"
638
+ raise ValueError(msg)
630
639
  if np.any(np.isnan(self.xp)):
631
- raise ValueError("xp must not contain nan values")
640
+ msg = "xp must not contain nan values"
641
+ raise ValueError(msg)
632
642
 
633
643
  def interp(self, x: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
634
644
  """Interpolate x against xp and fp.