oceantracker 0.4.1__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 (281) hide show
  1. oceantracker-0.4.1/LICENSE.md +21 -0
  2. oceantracker-0.4.1/MANIFEST.in +2 -0
  3. oceantracker-0.4.1/PKG-INFO +65 -0
  4. oceantracker-0.4.1/README.md +30 -0
  5. oceantracker-0.4.1/dev/__init__.py +0 -0
  6. oceantracker-0.4.1/dev/benchmark_timings/__init__.py +0 -0
  7. oceantracker-0.4.1/dev/benchmark_timings/benchmark_computer.py +36 -0
  8. oceantracker-0.4.1/dev/bug_hunting/Debugg_codes/Connectivity_between_farms_RV.py +93 -0
  9. oceantracker-0.4.1/dev/bug_hunting/Debugg_codes/__init__.py +0 -0
  10. oceantracker-0.4.1/dev/bug_hunting/__init__.py +0 -0
  11. oceantracker-0.4.1/dev/bug_hunting/reproduce_bug.py +401 -0
  12. oceantracker-0.4.1/dev/check_code/__init__.py +0 -0
  13. oceantracker-0.4.1/dev/check_code/check_functions.py +39 -0
  14. oceantracker-0.4.1/dev/dev_template.py +89 -0
  15. oceantracker-0.4.1/dev/dev_testing/__init__.py +0 -0
  16. oceantracker-0.4.1/dev/dev_testing/dev_merge_nested_grids.py +215 -0
  17. oceantracker-0.4.1/dev/dev_testing/mockups/__init__.py +0 -0
  18. oceantracker-0.4.1/dev/dev_testing/mockups/async_reader_mockup.py +373 -0
  19. oceantracker-0.4.1/dev/dev_testing/mockups/checkpoint_mockup.py +26 -0
  20. oceantracker-0.4.1/dev/dev_testing/mockups/type_dict.py +8 -0
  21. oceantracker-0.4.1/dev/dev_testing/mockups/webApps/__init__.py +0 -0
  22. oceantracker-0.4.1/dev/dev_testing/mockups/webApps/onlineTool_eDA.py +333 -0
  23. oceantracker-0.4.1/dev/dev_testing/mockups/webApps/onlineTool_oceanPlastics.py +145 -0
  24. oceantracker-0.4.1/dev/dev_testing/run_dev_version.py +39 -0
  25. oceantracker-0.4.1/dev/dev_testing/scratch_tests/AOSnumba_speed.py +89 -0
  26. oceantracker-0.4.1/dev/dev_testing/scratch_tests/__init__.py +0 -0
  27. oceantracker-0.4.1/dev/dev_testing/scratch_tests/branchless_code/__init__.py +0 -0
  28. oceantracker-0.4.1/dev/dev_testing/scratch_tests/branchless_code/branchless_div_zero.py +83 -0
  29. oceantracker-0.4.1/dev/dev_testing/scratch_tests/branchless_code/branchless_max_choice.py +78 -0
  30. oceantracker-0.4.1/dev/dev_testing/scratch_tests/branchless_code/branchless_val_choice.py +120 -0
  31. oceantracker-0.4.1/dev/dev_testing/scratch_tests/fastmath_tests.py +102 -0
  32. oceantracker-0.4.1/dev/dev_testing/scratch_tests/mask_verses_sel.py +81 -0
  33. oceantracker-0.4.1/dev/dev_testing/scratch_tests/masking_branchless.py +68 -0
  34. oceantracker-0.4.1/dev/dev_testing/scratch_tests/multiproc_approach_speed.py +179 -0
  35. oceantracker-0.4.1/dev/dev_testing/scratch_tests/numba_dim_choice.py +49 -0
  36. oceantracker-0.4.1/dev/dev_testing/scratch_tests/numba_function_dispatch_speed.py +95 -0
  37. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/NumbaNestedCallls.py +78 -0
  38. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/__init__.py +0 -0
  39. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/indexingSpeed_sorted_true_not_true.py +77 -0
  40. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/interp_by_tri_3Dvectors.py +196 -0
  41. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/interp_by_tri_nodes.py +221 -0
  42. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/interp_eval_kernal.py +188 -0
  43. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/numba_custom_dtype.py +73 -0
  44. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/numba_dict_to__struct_or_class.py +35 -0
  45. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/numpy_compound_dtype.py +110 -0
  46. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/speed_array_of_struct.py +110 -0
  47. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/speed_array_of_struct_threads.py +74 -0
  48. oceantracker-0.4.1/dev/dev_testing/scratch_tests/old/threading_cost_estimateV3.py +80 -0
  49. oceantracker-0.4.1/dev/dev_testing/scratch_tests/run_dev_version.py +39 -0
  50. oceantracker-0.4.1/dev/dev_testing/scratch_tests/simd/__init__.py +0 -0
  51. oceantracker-0.4.1/dev/dev_testing/scratch_tests/simd/simd_test1.py +111 -0
  52. oceantracker-0.4.1/dev/dev_testing/scratch_tests/simd/simd_test2.py +137 -0
  53. oceantracker-0.4.1/dev/dev_testing/scratch_tests/simd/simd_test3_innerloop.py +118 -0
  54. oceantracker-0.4.1/dev/dev_testing/scratch_tests/slots.py +28 -0
  55. oceantracker-0.4.1/dev/dev_testing/scratch_tests/slots_speed.py +54 -0
  56. oceantracker-0.4.1/dev/dev_testing/scratch_tests/speed_range_index.py +27 -0
  57. oceantracker-0.4.1/dev/dev_testing/scratch_tests/vertical_search_speed.py +86 -0
  58. oceantracker-0.4.1/dev/dev_testing/scratch_tests/xarray/__init__.py +0 -0
  59. oceantracker-0.4.1/dev/dev_testing/scratch_tests/xarray/xarray_multi_file.py +37 -0
  60. oceantracker-0.4.1/dev/dev_testing/scratch_tests/xarray/xarray_speed.py +77 -0
  61. oceantracker-0.4.1/dev/misc/__init__.py +0 -0
  62. oceantracker-0.4.1/dev/misc/paper_figure2024.py +122 -0
  63. oceantracker-0.4.1/dev/misc/paper_figure2024_appendix.py +119 -0
  64. oceantracker-0.4.1/dev/misc/test_HG.py +88 -0
  65. oceantracker-0.4.1/dev/misc/test_NZnational.py +79 -0
  66. oceantracker-0.4.1/dev/misc/test_NZports.py +98 -0
  67. oceantracker-0.4.1/dev/misc/test_WHOI.py +65 -0
  68. oceantracker-0.4.1/dev/misc/test_sounds.py +65 -0
  69. oceantracker-0.4.1/dev/preprocessing/__init__.py +0 -0
  70. oceantracker-0.4.1/dev/preprocessing/compress_hindcast.py +93 -0
  71. oceantracker-0.4.1/dev/reader_checks/__init__.py +0 -0
  72. oceantracker-0.4.1/dev/reader_checks/sea_spurgev01.py +58 -0
  73. oceantracker-0.4.1/dev/util/__init__.py +0 -0
  74. oceantracker-0.4.1/dev/util/scale_offset_hindcast.py +76 -0
  75. oceantracker-0.4.1/docs/__init__.py +0 -0
  76. oceantracker-0.4.1/docs/build_parameter_ref.py +296 -0
  77. oceantracker-0.4.1/docs/conf.py +70 -0
  78. oceantracker-0.4.1/docs/gatherDefaultParams.py +49 -0
  79. oceantracker-0.4.1/installing/__init__.py +0 -0
  80. oceantracker-0.4.1/oceantracker/__init__.py +2 -0
  81. oceantracker-0.4.1/oceantracker/_oceantracker_case_runner.py +509 -0
  82. oceantracker-0.4.1/oceantracker/_oceantracker_main_runner.py +502 -0
  83. oceantracker-0.4.1/oceantracker/definitions.py +92 -0
  84. oceantracker-0.4.1/oceantracker/dispersion/__init__.py +0 -0
  85. oceantracker-0.4.1/oceantracker/dispersion/_base_dispersion.py +25 -0
  86. oceantracker-0.4.1/oceantracker/dispersion/random_walk.py +105 -0
  87. oceantracker-0.4.1/oceantracker/event_loggers/__init__.py +0 -0
  88. oceantracker-0.4.1/oceantracker/event_loggers/_base_event_loggers.py +141 -0
  89. oceantracker-0.4.1/oceantracker/event_loggers/log_polygon_entry_and_exit.py +65 -0
  90. oceantracker-0.4.1/oceantracker/field_group_manager/__init__.py +0 -0
  91. oceantracker-0.4.1/oceantracker/field_group_manager/dev_nested_grids_field_group_manager.py +290 -0
  92. oceantracker-0.4.1/oceantracker/field_group_manager/field_group_manager.py +269 -0
  93. oceantracker-0.4.1/oceantracker/field_group_manager/util/__init__.py +0 -0
  94. oceantracker-0.4.1/oceantracker/field_group_manager/util/field_group_manager_util.py +28 -0
  95. oceantracker-0.4.1/oceantracker/fields/__init__.py +0 -0
  96. oceantracker-0.4.1/oceantracker/fields/_base_field.py +70 -0
  97. oceantracker-0.4.1/oceantracker/fields/field_vertical_gradient.py +79 -0
  98. oceantracker-0.4.1/oceantracker/fields/friction_velocity.py +132 -0
  99. oceantracker-0.4.1/oceantracker/fields/reader_field.py +18 -0
  100. oceantracker-0.4.1/oceantracker/fields/total_water_depth.py +38 -0
  101. oceantracker-0.4.1/oceantracker/fields/util/__init__.py +0 -0
  102. oceantracker-0.4.1/oceantracker/integrated_model/__init__.py +0 -0
  103. oceantracker-0.4.1/oceantracker/integrated_model/_base_model.py +21 -0
  104. oceantracker-0.4.1/oceantracker/integrated_model/lagraingian_structures_FTLE_2D.py +302 -0
  105. oceantracker-0.4.1/oceantracker/interpolator/__init__.py +0 -0
  106. oceantracker-0.4.1/oceantracker/interpolator/_base_interp.py +24 -0
  107. oceantracker-0.4.1/oceantracker/interpolator/_eval_interp_triangles.py +114 -0
  108. oceantracker-0.4.1/oceantracker/interpolator/_find_hori_cell_triangle_walk.py +102 -0
  109. oceantracker-0.4.1/oceantracker/interpolator/_find_vertical_cell_classes.py +400 -0
  110. oceantracker-0.4.1/oceantracker/interpolator/depricated/__init__.py +0 -0
  111. oceantracker-0.4.1/oceantracker/interpolator/dev/__init__.py +0 -0
  112. oceantracker-0.4.1/oceantracker/interpolator/interp_triangle_native_grid.py +197 -0
  113. oceantracker-0.4.1/oceantracker/interpolator/util/__init__.py +0 -0
  114. oceantracker-0.4.1/oceantracker/interpolator/util/depricated/__init__.py +0 -0
  115. oceantracker-0.4.1/oceantracker/interpolator/util/dev/__init__.py +0 -0
  116. oceantracker-0.4.1/oceantracker/interpolator/util/interp_kernals.py +12 -0
  117. oceantracker-0.4.1/oceantracker/interpolator/util/triangle_eval_interp.py +215 -0
  118. oceantracker-0.4.1/oceantracker/interpolator/util/triangle_interpolator_util.py +220 -0
  119. oceantracker-0.4.1/oceantracker/main.py +137 -0
  120. oceantracker-0.4.1/oceantracker/particle_concentrations/__init__.py +0 -0
  121. oceantracker-0.4.1/oceantracker/particle_concentrations/_base_user_triangle_properties.py +80 -0
  122. oceantracker-0.4.1/oceantracker/particle_concentrations/particle_concentrations.py +94 -0
  123. oceantracker-0.4.1/oceantracker/particle_group_manager/__init__.py +0 -0
  124. oceantracker-0.4.1/oceantracker/particle_group_manager/particle_group_manager.py +263 -0
  125. oceantracker-0.4.1/oceantracker/particle_group_manager/util/__init__.py +0 -0
  126. oceantracker-0.4.1/oceantracker/particle_group_manager/util/pgm_util.py +25 -0
  127. oceantracker-0.4.1/oceantracker/particle_properties/__init__.py +0 -0
  128. oceantracker-0.4.1/oceantracker/particle_properties/_base_particle_properties.py +160 -0
  129. oceantracker-0.4.1/oceantracker/particle_properties/age_decay.py +28 -0
  130. oceantracker-0.4.1/oceantracker/particle_properties/dev/__init__.py +0 -0
  131. oceantracker-0.4.1/oceantracker/particle_properties/dev/eDNAdetectionBackwards.py +32 -0
  132. oceantracker-0.4.1/oceantracker/particle_properties/distance_travelled.py +63 -0
  133. oceantracker-0.4.1/oceantracker/particle_properties/inside_polygons.py +47 -0
  134. oceantracker-0.4.1/oceantracker/particle_properties/load_carrying.py +38 -0
  135. oceantracker-0.4.1/oceantracker/particle_properties/particle_operations.py +19 -0
  136. oceantracker-0.4.1/oceantracker/particle_properties/particle_parameter_from_normal_distribution.py +27 -0
  137. oceantracker-0.4.1/oceantracker/particle_properties/total_water_depth.py +31 -0
  138. oceantracker-0.4.1/oceantracker/particle_properties/util/__init__.py +0 -0
  139. oceantracker-0.4.1/oceantracker/particle_properties/util/particle_comparisons_util.py +94 -0
  140. oceantracker-0.4.1/oceantracker/particle_properties/util/particle_operations_util.py +137 -0
  141. oceantracker-0.4.1/oceantracker/particle_properties/water_speed.py +25 -0
  142. oceantracker-0.4.1/oceantracker/particle_statistics/__init__.py +0 -0
  143. oceantracker-0.4.1/oceantracker/particle_statistics/_base_location_stats.py +260 -0
  144. oceantracker-0.4.1/oceantracker/particle_statistics/dev/__init__.py +0 -0
  145. oceantracker-0.4.1/oceantracker/particle_statistics/gridded_statistics2D.py +322 -0
  146. oceantracker-0.4.1/oceantracker/particle_statistics/gridded_statistics3D.py +163 -0
  147. oceantracker-0.4.1/oceantracker/particle_statistics/polygon_statistics.py +250 -0
  148. oceantracker-0.4.1/oceantracker/particle_statistics/resident_in_polygon.py +158 -0
  149. oceantracker-0.4.1/oceantracker/reader/DEFT3DFM_reader.py +254 -0
  150. oceantracker-0.4.1/oceantracker/reader/FVCOM_reader.py +199 -0
  151. oceantracker-0.4.1/oceantracker/reader/GLORYS_reader.py +220 -0
  152. oceantracker-0.4.1/oceantracker/reader/ROMS_reader.py +272 -0
  153. oceantracker-0.4.1/oceantracker/reader/SCHISM_reader.py +201 -0
  154. oceantracker-0.4.1/oceantracker/reader/SCHISM_reader_v5.py +37 -0
  155. oceantracker-0.4.1/oceantracker/reader/__init__.py +0 -0
  156. oceantracker-0.4.1/oceantracker/reader/_base_all_readers.py +819 -0
  157. oceantracker-0.4.1/oceantracker/reader/_base_structured_reader.py +42 -0
  158. oceantracker-0.4.1/oceantracker/reader/_base_unstructured_reader.py +84 -0
  159. oceantracker-0.4.1/oceantracker/reader/_oceantracker_dataset.py +343 -0
  160. oceantracker-0.4.1/oceantracker/reader/depricated/__init__.py +0 -0
  161. oceantracker-0.4.1/oceantracker/reader/dev/__init__.py +0 -0
  162. oceantracker-0.4.1/oceantracker/reader/dev/_base_generic_reader.py +251 -0
  163. oceantracker-0.4.1/oceantracker/reader/dev/dev_nemo_reader.py +17 -0
  164. oceantracker-0.4.1/oceantracker/reader/dev/generic_stuctured_reader.py +97 -0
  165. oceantracker-0.4.1/oceantracker/reader/dev/generic_unstructured_reader.py +247 -0
  166. oceantracker-0.4.1/oceantracker/reader/util/__init__.py +0 -0
  167. oceantracker-0.4.1/oceantracker/reader/util/dev_convert_new_schism_format.py +131 -0
  168. oceantracker-0.4.1/oceantracker/reader/util/dev_thredds_server_util.py +87 -0
  169. oceantracker-0.4.1/oceantracker/reader/util/get_hydro_model_info.py +9 -0
  170. oceantracker-0.4.1/oceantracker/reader/util/hydromodel_grid_transforms.py +263 -0
  171. oceantracker-0.4.1/oceantracker/reader/util/reader_util.py +131 -0
  172. oceantracker-0.4.1/oceantracker/reader/util/shared_reader_memory_util.py +12 -0
  173. oceantracker-0.4.1/oceantracker/release_groups/__init__.py +0 -0
  174. oceantracker-0.4.1/oceantracker/release_groups/_base_release_group.py +223 -0
  175. oceantracker-0.4.1/oceantracker/release_groups/grid_release.py +68 -0
  176. oceantracker-0.4.1/oceantracker/release_groups/point_release.py +68 -0
  177. oceantracker-0.4.1/oceantracker/release_groups/polygon_release.py +75 -0
  178. oceantracker-0.4.1/oceantracker/resuspension/__init__.py +0 -0
  179. oceantracker-0.4.1/oceantracker/resuspension/_base_resuspension.py +15 -0
  180. oceantracker-0.4.1/oceantracker/resuspension/depricated/__init__.py +0 -0
  181. oceantracker-0.4.1/oceantracker/resuspension/depricated/resuspension_using_bottom_stress.py +26 -0
  182. oceantracker-0.4.1/oceantracker/resuspension/resuspension.py +71 -0
  183. oceantracker-0.4.1/oceantracker/run_ot_cmd_line.py +53 -0
  184. oceantracker-0.4.1/oceantracker/shared_info.py +321 -0
  185. oceantracker-0.4.1/oceantracker/solver/__init__.py +0 -0
  186. oceantracker-0.4.1/oceantracker/solver/solver.py +380 -0
  187. oceantracker-0.4.1/oceantracker/solver/util/__init__.py +0 -0
  188. oceantracker-0.4.1/oceantracker/solver/util/dev_triangle_kernnal_solver.py +78 -0
  189. oceantracker-0.4.1/oceantracker/solver/util/solver_util.py +33 -0
  190. oceantracker-0.4.1/oceantracker/tidal_stranding/__init__.py +0 -0
  191. oceantracker-0.4.1/oceantracker/tidal_stranding/tidal_stranding.py +47 -0
  192. oceantracker-0.4.1/oceantracker/time_varying_info/__init__.py +0 -0
  193. oceantracker-0.4.1/oceantracker/time_varying_info/_base_time_varying_info.py +51 -0
  194. oceantracker-0.4.1/oceantracker/tracks_writer/__init__.py +0 -0
  195. oceantracker-0.4.1/oceantracker/tracks_writer/_base_tracks_writer.py +189 -0
  196. oceantracker-0.4.1/oceantracker/tracks_writer/depricated/__init__.py +0 -0
  197. oceantracker-0.4.1/oceantracker/tracks_writer/dev_convert_compact_tracks.py +93 -0
  198. oceantracker-0.4.1/oceantracker/tracks_writer/track_writer_compact.py +123 -0
  199. oceantracker-0.4.1/oceantracker/trajectory_modifiers/__init__.py +0 -0
  200. oceantracker-0.4.1/oceantracker/trajectory_modifiers/_base_trajectory_modifers.py +14 -0
  201. oceantracker-0.4.1/oceantracker/trajectory_modifiers/cull_particles.py +82 -0
  202. oceantracker-0.4.1/oceantracker/trajectory_modifiers/cull_rate.py +38 -0
  203. oceantracker-0.4.1/oceantracker/trajectory_modifiers/settle_in_polygon.py +68 -0
  204. oceantracker-0.4.1/oceantracker/trajectory_modifiers/split_particles.py +90 -0
  205. oceantracker-0.4.1/oceantracker/trajectory_modifiers/surface_float.py +23 -0
  206. oceantracker-0.4.1/oceantracker/util/__init__.py +0 -0
  207. oceantracker-0.4.1/oceantracker/util/__root_parameter_base_class__.py +4 -0
  208. oceantracker-0.4.1/oceantracker/util/basic_util.py +82 -0
  209. oceantracker-0.4.1/oceantracker/util/class_importer_util.py +200 -0
  210. oceantracker-0.4.1/oceantracker/util/cord_transforms.py +110 -0
  211. oceantracker-0.4.1/oceantracker/util/debug_util.py +83 -0
  212. oceantracker-0.4.1/oceantracker/util/dev/OTreRunner.py +252 -0
  213. oceantracker-0.4.1/oceantracker/util/dev/__init__.py +0 -0
  214. oceantracker-0.4.1/oceantracker/util/dev/dev_random_points_in_polygon.py +27 -0
  215. oceantracker-0.4.1/oceantracker/util/dev_shared_memory_util.py +53 -0
  216. oceantracker-0.4.1/oceantracker/util/geometry.py +33 -0
  217. oceantracker-0.4.1/oceantracker/util/get_versions_computer_info.py +26 -0
  218. oceantracker-0.4.1/oceantracker/util/json_util.py +157 -0
  219. oceantracker-0.4.1/oceantracker/util/message_logger.py +237 -0
  220. oceantracker-0.4.1/oceantracker/util/ncdf_util.py +281 -0
  221. oceantracker-0.4.1/oceantracker/util/numba_util.py +137 -0
  222. oceantracker-0.4.1/oceantracker/util/numpy_util.py +59 -0
  223. oceantracker-0.4.1/oceantracker/util/output_util.py +71 -0
  224. oceantracker-0.4.1/oceantracker/util/parameter_base_class.py +147 -0
  225. oceantracker-0.4.1/oceantracker/util/parameter_checking.py +318 -0
  226. oceantracker-0.4.1/oceantracker/util/polygon_util.py +295 -0
  227. oceantracker-0.4.1/oceantracker/util/profiling_util.py +85 -0
  228. oceantracker-0.4.1/oceantracker/util/read_geometry.py +62 -0
  229. oceantracker-0.4.1/oceantracker/util/read_points_polygons.py +21 -0
  230. oceantracker-0.4.1/oceantracker/util/regular_grid_util.py +29 -0
  231. oceantracker-0.4.1/oceantracker/util/scheduler.py +141 -0
  232. oceantracker-0.4.1/oceantracker/util/setup_util.py +172 -0
  233. oceantracker-0.4.1/oceantracker/util/status_util.py +16 -0
  234. oceantracker-0.4.1/oceantracker/util/time_util.py +63 -0
  235. oceantracker-0.4.1/oceantracker/util/triangle_utilities.py +278 -0
  236. oceantracker-0.4.1/oceantracker/util/yaml_util.py +27 -0
  237. oceantracker-0.4.1/oceantracker/velocity_modifiers/__init__.py +0 -0
  238. oceantracker-0.4.1/oceantracker/velocity_modifiers/_base_velocity_modifer.py +21 -0
  239. oceantracker-0.4.1/oceantracker/velocity_modifiers/terminal_velocity.py +63 -0
  240. oceantracker-0.4.1/oceantracker.egg-info/PKG-INFO +65 -0
  241. oceantracker-0.4.1/oceantracker.egg-info/SOURCES.txt +279 -0
  242. oceantracker-0.4.1/oceantracker.egg-info/dependency_links.txt +1 -0
  243. oceantracker-0.4.1/oceantracker.egg-info/requires.txt +10 -0
  244. oceantracker-0.4.1/oceantracker.egg-info/top_level.txt +8 -0
  245. oceantracker-0.4.1/plot_oceantracker/__init__.py +0 -0
  246. oceantracker-0.4.1/plot_oceantracker/plot_statistics.py +244 -0
  247. oceantracker-0.4.1/plot_oceantracker/plot_tracks.py +179 -0
  248. oceantracker-0.4.1/plot_oceantracker/plot_utilities.py +235 -0
  249. oceantracker-0.4.1/read_oceantracker/__init__.py +0 -0
  250. oceantracker-0.4.1/read_oceantracker/python/__init__.py +0 -0
  251. oceantracker-0.4.1/read_oceantracker/python/load_output_files.py +208 -0
  252. oceantracker-0.4.1/read_oceantracker/python/read_ncdf_output_files.py +331 -0
  253. oceantracker-0.4.1/setup.cfg +4 -0
  254. oceantracker-0.4.1/setup.py +35 -0
  255. oceantracker-0.4.1/tests/__init__.py +0 -0
  256. oceantracker-0.4.1/tests/circle_test/__init__.py +0 -0
  257. oceantracker-0.4.1/tests/circle_test/test_base.py +357 -0
  258. oceantracker-0.4.1/tests/profiling/__init__.py +0 -0
  259. oceantracker-0.4.1/tests/profiling/profileOT.py +169 -0
  260. oceantracker-0.4.1/tests/test_reader_formats.py +490 -0
  261. oceantracker-0.4.1/tests/unit_test_master.py +50 -0
  262. oceantracker-0.4.1/tests/unit_tests/__init__.py +0 -0
  263. oceantracker-0.4.1/tests/unit_tests/test_definitions.py +215 -0
  264. oceantracker-0.4.1/tests/unit_tests/unit_test_01_check-against-ref.py +60 -0
  265. oceantracker-0.4.1/tests/unit_tests/unit_test_02_param_errors.py +45 -0
  266. oceantracker-0.4.1/tests/unit_tests/unit_test_03_release_group_errors.py +41 -0
  267. oceantracker-0.4.1/tests/unit_tests/unit_test_04_features_checks.py +55 -0
  268. oceantracker-0.4.1/tests/unit_tests/unit_test_05_parallel.py +54 -0
  269. oceantracker-0.4.1/tests/unit_tests/unit_test_06_2Drun.py +46 -0
  270. oceantracker-0.4.1/tests/unit_tests/unit_test_07_ROMSgrid.py +78 -0
  271. oceantracker-0.4.1/tests/unit_tests/unit_test_80_LagrangianStructuresFTLE.py +94 -0
  272. oceantracker-0.4.1/tests/unit_tests/unit_test_90_schism56_plots.py +53 -0
  273. oceantracker-0.4.1/tests/unit_tests/unit_test_99_run_from_json.py +7 -0
  274. oceantracker-0.4.1/tutorials_how_to/A_minimal_example.py +100 -0
  275. oceantracker-0.4.1/tutorials_how_to/B_running_with_helper_class.py +169 -0
  276. oceantracker-0.4.1/tutorials_how_to/C_release_groups.py +106 -0
  277. oceantracker-0.4.1/tutorials_how_to/D_output_files.py +123 -0
  278. oceantracker-0.4.1/tutorials_how_to/E_run_using_parameter_dictionaries.py +162 -0
  279. oceantracker-0.4.1/tutorials_how_to/G_onthefly_statistics.py +258 -0
  280. oceantracker-0.4.1/tutorials_how_to/P_running_cases_in_parallel.py +139 -0
  281. oceantracker-0.4.1/tutorials_how_to/__init__.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 oceantracker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include README.md
2
+ include LICENSE.md
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.2
2
+ Name: oceantracker
3
+ Version: 0.4.1
4
+ Summary: Fast offline Lagrangian particle tracking in the Ocean
5
+ Home-page: https://oceantracker.github.io/oceantracker/
6
+ Author: Ross Vennell & Laurin Steidle
7
+ Author-email: ross.vennell@cawthron.org.nz
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Scientific/Engineering :: Oceanography
15
+ Requires-Python: >=3.10,<3.12
16
+ License-File: LICENSE.md
17
+ Requires-Dist: numpy<2
18
+ Requires-Dist: numba
19
+ Requires-Dist: netcdf4
20
+ Requires-Dist: xarray
21
+ Requires-Dist: scipy
22
+ Requires-Dist: pyproj
23
+ Requires-Dist: setuptools
24
+ Requires-Dist: psutil
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: pyyaml
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: home-page
32
+ Dynamic: requires-dist
33
+ Dynamic: requires-python
34
+ Dynamic: summary
35
+
36
+ # OceanTracker
37
+
38
+ ## Fast particle tracking in structure and unstructured grids
39
+
40
+ OceanTracker is a fast extendable code for offline particle tracking in structured and unstructured grids [1].
41
+
42
+ OceanTracker currently supports strctured grid ROMs and GLORYS(NEMO/COPERNICUS)
43
+ for fixed z level vertical grids and unstructured grids of SCHISM and DELFT3D-FM
44
+
45
+ OceanTracker’s speed enables millions of particles to be simulated in unstructured grids. This significantly increases
46
+ the range of particle behaviours that can be modeled and the quality of statistics derived from the particles.
47
+ To eliminate the need to store and wade through the analysis of vast volumes of recorded particle tracks, the code has
48
+ the ability to calculate statistics on the fly, such as heat maps and connectivity between regions.
49
+
50
+ OceanTracker code is highly flexible and extendable by the user, whether run by a new user with a text file of
51
+ parameters, or by an expert adding their specialised code for novel particle behaviours or statistics, to the computational pipe line
52
+
53
+
54
+ [More about Ocean tracker and gallery](https://oceantracker.github.io/oceantracker/)
55
+
56
+ [Installing Oceantracker](https://oceantracker.github.io/oceantracker/_build/html/info/installing.html)
57
+
58
+ [Oceantracker User Guide](https://oceantracker.github.io/oceantracker/_build/html/info/users_guide.html)
59
+
60
+ [Running Oceantracker ](https://oceantracker.github.io/oceantracker/_build/html/info/running_ocean_tracker.html)
61
+
62
+ [Howto tutorials](https://oceantracker.github.io/oceantracker/_build/html/info/how_to.html)
63
+
64
+
65
+ [1] Vennell, R., Scheel, M., Weppe, S., Knight, B. and Smeaton, M., 2021. Fast lagrangian particle tracking in unstructured ocean model grids , Ocean Dynamics, 71(4), pp.423-437.
@@ -0,0 +1,30 @@
1
+ # OceanTracker
2
+
3
+ ## Fast particle tracking in structure and unstructured grids
4
+
5
+ OceanTracker is a fast extendable code for offline particle tracking in structured and unstructured grids [1].
6
+
7
+ OceanTracker currently supports strctured grid ROMs and GLORYS(NEMO/COPERNICUS)
8
+ for fixed z level vertical grids and unstructured grids of SCHISM and DELFT3D-FM
9
+
10
+ OceanTracker’s speed enables millions of particles to be simulated in unstructured grids. This significantly increases
11
+ the range of particle behaviours that can be modeled and the quality of statistics derived from the particles.
12
+ To eliminate the need to store and wade through the analysis of vast volumes of recorded particle tracks, the code has
13
+ the ability to calculate statistics on the fly, such as heat maps and connectivity between regions.
14
+
15
+ OceanTracker code is highly flexible and extendable by the user, whether run by a new user with a text file of
16
+ parameters, or by an expert adding their specialised code for novel particle behaviours or statistics, to the computational pipe line
17
+
18
+
19
+ [More about Ocean tracker and gallery](https://oceantracker.github.io/oceantracker/)
20
+
21
+ [Installing Oceantracker](https://oceantracker.github.io/oceantracker/_build/html/info/installing.html)
22
+
23
+ [Oceantracker User Guide](https://oceantracker.github.io/oceantracker/_build/html/info/users_guide.html)
24
+
25
+ [Running Oceantracker ](https://oceantracker.github.io/oceantracker/_build/html/info/running_ocean_tracker.html)
26
+
27
+ [Howto tutorials](https://oceantracker.github.io/oceantracker/_build/html/info/how_to.html)
28
+
29
+
30
+ [1] Vennell, R., Scheel, M., Weppe, S., Knight, B. and Smeaton, M., 2021. Fast lagrangian particle tracking in unstructured ocean model grids , Ocean Dynamics, 71(4), pp.423-437.
File without changes
File without changes
@@ -0,0 +1,36 @@
1
+ from oceantracker.main import OceanTracker
2
+ import argparse
3
+
4
+
5
+ if __name__ == "__main__":
6
+ parser = argparse.ArgumentParser()
7
+ parser.add_argument('--datadir',type=str)
8
+ parser.add_argument('--root_output_dir', type=str)
9
+ args = parser.parse_args()
10
+
11
+ if args.datadir:
12
+ input_dir = args.datadir
13
+ else:
14
+ input_dir = r'G:\Hindcasts_large\OceanNumNZ-2022-06-20\final_version\2017\01'
15
+
16
+ if args.root_output_dir:
17
+ root_output_dir = args.root_output_dir
18
+ else:
19
+ root_output_dir = r'F:\OceanTrackerOutput\bench_marks'
20
+
21
+ ot = OceanTracker()
22
+ ot.settings(time_step=15*60, use_A_Z_profile=False, write_tracks=False,
23
+ max_run_duration= 10*24*3600,
24
+ root_output_dir=root_output_dir, output_file_base='benchmark_v01')
25
+ ot.add_class('reader', input_dir = input_dir, file_mask = 'NZfinite*.nc',
26
+ time_buffer_size=12)
27
+
28
+ x0 = [-35.922300421719214, 174.665532083399] # hen and chickens, in outer grid
29
+ ot.add_class('release_groups', name='my_release_point', # user must provide a name for release group
30
+ points=[[1838293.4656, 5940629.8263]],
31
+ release_interval=0, # seconds between releasing particles
32
+ pulse_size=10**6, # number of particles released each release_interval
33
+ )
34
+
35
+ ot.run()
36
+
@@ -0,0 +1,93 @@
1
+ # Code to estimate connectivity between mussel farms and potential spat collection areas
2
+ # Date: 08/11/2024
3
+ # HPC edition
4
+
5
+ # Protocol: release particles everyday from mussel farms during the reproductive season and advect them for 35 days. Settlement occurs after 21 days.
6
+ # Use the version 0.4_1 of Oceantracker
7
+
8
+ ## Import packages ##
9
+ from oceantracker.main import OceanTracker
10
+ from oceantracker.util import yaml_util, cord_transforms
11
+ from os import path
12
+ import numpy as np
13
+ import argparse
14
+ import shapely.vectorized
15
+ from shapely.geometry import Point
16
+ from datetime import datetime
17
+ import geopandas as gpd # Need to be installed with pip command
18
+
19
+ ## Model selection ##
20
+ ot = OceanTracker()
21
+ ## Set basic settings ##
22
+ ot.settings(output_file_base =r'Connectivity_farms_GLM_OT_outputs', # name used as base for output files
23
+ root_output_dir = '/hpcfreenas/romain/GM_connectivity_MBS',
24
+ #root_output_dir = r'D:\OceanTrackerOutput\bug_hunting',
25
+ add_date_to_run_output_dir = True,
26
+ # Run parameters
27
+ backtracking = False,
28
+ time_step = 600.0, # in seconds, time-step of interpolation
29
+ # Parallel run
30
+ processors=6, # Set up parallel run on x processors
31
+ # Register outputs
32
+ screen_output_time_interval = 3600*24, # Only print a line on screen once a day
33
+ write_tracks = True,
34
+ )
35
+
36
+ ## Add reader for oceanographic data ##
37
+ if __name__ == '__main__':
38
+ ot.add_class('reader',
39
+ input_dir ='/hpcfreenas/hindcast/UpperSouthIsland/HABs2018benk/nogrowth', # folder to search for hindcast files
40
+ #input_dir = r'D:\Hindcasts\UpperSouthIsland\2018_benHABS\nogrowth',
41
+ # folder to search for hindcast files
42
+ file_mask = 'Nydia*.nc', # hindcast netcdf file
43
+ time_buffer_size = 20,
44
+ )
45
+
46
+ ## Add physical properties ##
47
+ ot.add_class('resuspension', critical_friction_velocity = 0.001) # only re-suspend particles if friction vel. exceeds this value
48
+ ot.add_class('dispersion',
49
+ A_H = 0.2, # Horizontal diffusion coeff
50
+ A_V = 0.001, # Vertical diffusion coeff
51
+ )
52
+
53
+ # Import polygons in Marlborough Sounds
54
+ import json
55
+ with open('Farms_MBS_GB_TB.geojson') as f:
56
+ Marlb_polygons = json.load(f)
57
+ polygon_list = list()
58
+ for feature in Marlb_polygons['features']:
59
+ polygon_coords = feature['geometry']['coordinates'][0][0]
60
+ new_poly = dict(points=polygon_coords, user_polygonID=feature['properties']['id'])
61
+ polygon_list.append(new_poly)
62
+
63
+ for s_idx, s in enumerate(polygon_list[0:-1], start=0):
64
+ ot.add_class('release_groups', name = str(s_idx), # user must provide a name for group first
65
+ class_name = 'oceantracker.release_groups.polygon_release.PolygonRelease',
66
+ points = polygon_list[s_idx].get("points"), # must be an N by 2 or 3 or list, convertible to a numpy array
67
+ release_interval = 3600, # seconds between releasing particles - in weeks currently
68
+ pulse_size = 10, # number of particles released each release_interval
69
+ start = datetime.strptime('01/02/2018', "%d/%m/%Y").isoformat(),
70
+ end = datetime.strptime('01/06/2018', "%d/%m/%Y").isoformat(),
71
+ max_age = 24*3600*35,
72
+ case = s_idx,
73
+ )
74
+
75
+ ot.add_class('particle_statistics', name='Connectivity_matrix',
76
+ class_name='PolygonStats2D_ageBased',
77
+ start=datetime.strptime('01/02/2018', "%d/%m/%Y").isoformat(),
78
+ end=datetime.strptime('01/08/2018', "%d/%m/%Y").isoformat(),
79
+ polygon_list=polygon_list,
80
+ min_age_to_bin = 21*24*3600,
81
+ update_interval= 24 * 3600,
82
+ case = s_idx,
83
+ )
84
+
85
+
86
+ ## Print parameters to check run ##
87
+ print(ot.params)
88
+ #import json
89
+ #print(json.dumps(ot.params, indent=4))
90
+ ## Run oceantracker ##
91
+ # as helper "ot" has set params above, simply run it
92
+ case_info_file_name = ot.run()
93
+ print('case file name=', case_info_file_name)
File without changes
@@ -0,0 +1,401 @@
1
+ # %% [markdown]
2
+ # ## Preparation
3
+
4
+ # %%
5
+ from oceantracker.main import run
6
+ from read_oceantracker.python import load_output_files
7
+ from plot_oceantracker import plot_tracks
8
+ from plot_oceantracker import plot_statistics
9
+
10
+ import os
11
+ import numpy as np
12
+ import matplotlib.pyplot as plt
13
+
14
+ # %% [markdown]
15
+ # ### Model
16
+
17
+ # %%
18
+ model_name = "shit_predictor_2000_debug"
19
+
20
+ # I/O
21
+ input_dir = "/hpcfreenas/hindcast/OceanNumNZ-2022-06-20/final_version/2019/"
22
+ output_dir = "/hpcfreenas/laurin/malcolms_marvelous_shit_predictor_output"
23
+
24
+ # time parameters
25
+ model_duration = 60*24*3600
26
+ data_time_step = 3600
27
+ model_time_step = 60
28
+ model_steps = int(model_duration/model_time_step)
29
+
30
+ # particle release
31
+ pulse_size = 10
32
+ release_interval = 3600
33
+
34
+ # output
35
+ # i think there is no good reason to have the output step size
36
+ # smaller then the model step size though.
37
+ output_time_step = model_time_step
38
+ output_steps = int(model_duration/output_time_step)
39
+ grid_size = 100
40
+
41
+
42
+ # %% [markdown]
43
+ # ### Flux
44
+
45
+ # %%
46
+ # feed
47
+ feed_input_per_year_per_pen = 2.214e3
48
+
49
+ feed_sinking_velocity = 0.095
50
+ feed_decay_rate = 0.086/(24*3600) # per day
51
+ feed_critical_friction_velocity = 0.015
52
+
53
+ feed_water_ratio = 0.09
54
+ feed_digestion_ratio = 0.85
55
+ feed_waste_ratio = 0.03
56
+
57
+ # shit
58
+
59
+ shit_sinking_velocity = 0.032
60
+ shit_decay_rate = 0.086/(24*3600) # per day
61
+ shit_critical_friction_velocity = 0.009
62
+
63
+ # fluxes
64
+ feed_mass_dry = (1-feed_water_ratio)*feed_input_per_year_per_pen
65
+ feed_consumed = (1-feed_waste_ratio)*feed_mass_dry
66
+ feed_wasted = feed_waste_ratio*feed_mass_dry
67
+
68
+ shit_produced = (1-feed_digestion_ratio)*feed_consumed
69
+
70
+ flux_feed = feed_wasted
71
+ flux_shit = shit_produced
72
+
73
+ #
74
+ pulses_per_year = int(3600*24*365/release_interval)
75
+ inital_mass_per_pertical = 1/(pulse_size*pulses_per_year)
76
+
77
+ initial_feed_particle_mass = flux_feed*inital_mass_per_pertical
78
+ initial_shit_particle_mass = flux_shit*inital_mass_per_pertical
79
+
80
+
81
+
82
+ # %% [markdown]
83
+ def create_case_dict_for_pen(pen_position,depth_range,
84
+ pulse_size=pulse_size,
85
+ release_interval=release_interval,
86
+ feed_sinking_velocity=feed_sinking_velocity,
87
+ feed_decay_rate=feed_decay_rate,
88
+ shit_sinking_velocity=shit_sinking_velocity,
89
+ shit_decay_rate=shit_decay_rate):
90
+ """
91
+ Takes a list of [x_min,x_max,y_min,y_max] for the pen_position
92
+ and a list of [z_top,z_bottom] for the depth_range and returns a
93
+ dict
94
+ """
95
+ x_min,x_max,y_min,y_max = pen_position
96
+ z_top,z_bottom = depth_range
97
+
98
+ case = [
99
+ # food pellets
100
+ {
101
+ "particle_release_groups": [
102
+ {
103
+ "class_name": "oceantracker.release_groups.polygon_release.PolygonRelease",
104
+ "points": [
105
+ [
106
+ x_min,
107
+ y_min
108
+ ],
109
+ [
110
+ x_max,
111
+ y_min
112
+ ],
113
+ [
114
+ x_max,
115
+ y_max
116
+ ],
117
+ [
118
+ x_min,
119
+ y_max
120
+ ]
121
+ ],
122
+ "pulse_size": pulse_size,
123
+ "release_interval": release_interval,
124
+ "z_range": [z_top, z_bottom]
125
+ }
126
+ ],
127
+ "velocity_modifiers": [
128
+ {
129
+ "class_name": "oceantracker.velocity_modifiers.terminal_velocity.TerminalVelocity",
130
+ "mean": feed_sinking_velocity
131
+ }
132
+ ],
133
+ "particle_properties": [
134
+ {
135
+ "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
136
+ "decay_time_scale": 1/feed_decay_rate
137
+ }
138
+ ],
139
+ "trajectory_modifiers": [
140
+ {
141
+ "class_name": "oceantracker.resuspension.BasicResuspension",
142
+ "critical_friction_velocity": feed_critical_friction_velocity
143
+ }
144
+ ],
145
+ },
146
+ # shit pellets
147
+ {
148
+ "particle_release_groups": [
149
+ {
150
+ "class_name": "oceantracker.release_groups.polygon_release.PolygonRelease",
151
+ "points": [
152
+ [
153
+ x_min,
154
+ y_min
155
+ ],
156
+ [
157
+ x_max,
158
+ y_min
159
+ ],
160
+ [
161
+ x_max,
162
+ y_max
163
+ ],
164
+ [
165
+ x_min,
166
+ y_max
167
+ ]
168
+ ],
169
+ "pulse_size": pulse_size,
170
+ "release_interval": release_interval,
171
+ "z_range": [z_top, z_bottom]
172
+ }
173
+ ],
174
+ "velocity_modifiers": [
175
+ {
176
+ "class_name": "oceantracker.velocity_modifiers.terminal_velocity.TerminalVelocity",
177
+ "mean": shit_sinking_velocity
178
+ }
179
+ ],
180
+ "particle_properties": [
181
+ {
182
+ "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
183
+ "decay_time_scale": 1/shit_decay_rate
184
+ }
185
+ ],
186
+ "trajectory_modifiers": [
187
+ {
188
+ "class_name": "oceantracker.resuspension.BasicResuspension",
189
+ "critical_friction_velocity": shit_critical_friction_velocity
190
+ }
191
+ ],
192
+ }
193
+ ]
194
+
195
+ return case
196
+
197
+ # %%
198
+ list_of_pens = [
199
+ {
200
+ "name": "pen_1",
201
+ "pen_position": [
202
+ 1689853, # x_min
203
+ 1697645, # x_max
204
+ 5476738, # y_min
205
+ 5491327 # y_max
206
+ ],
207
+ "depth_range": [0, -30]
208
+ }
209
+ ]
210
+
211
+ # %%
212
+ params = {
213
+ "shared_params": {
214
+ "compact_mode": True,
215
+ "output_file_base": model_name,
216
+ "root_output_dir": output_dir,
217
+ "processors": 1,
218
+ },
219
+ "reader": {
220
+ "class_name": "oceantracker.reader.schism_reader.SCHISMreader",
221
+ "depth_average": False,
222
+ "file_mask": "NZfinite*.nc",
223
+ "input_dir": input_dir,
224
+ "search_sub_dirs": True,
225
+ # "hgrid_file_name": "/hpcfreenas/hindcast/OceanNumNZ-2022-06-20/final_version/hgridNZ_run.gr3",
226
+ },
227
+ "base_case_params": {
228
+ "dispersion": {
229
+ "A_H": 0.1,
230
+ "A_V": 0.001
231
+ },
232
+ "fields": [
233
+ {
234
+ "class_name": "oceantracker.fields.friction_velocity.FrictionVelocityFromNearSeaBedVelocity"
235
+ }
236
+ ],
237
+ "run_params": {
238
+ "block_dry_cells": True,
239
+ "use_open_boundary": True,
240
+ "write_tracks": True,
241
+ "duration": model_duration,
242
+ },
243
+ "solver": {
244
+ "n_sub_steps": int(data_time_step/model_time_step),
245
+ "screen_output_step_count": int(data_time_step/model_time_step)
246
+ },
247
+ "tracks_writer": {
248
+ "class_name": "oceantracker.tracks_writer.track_writer_compact.FlatTrackWriter",
249
+ "output_step_writer": 3600,
250
+ "write_dry_cell_flag": True
251
+ },
252
+ "particle_statistics": [
253
+ {
254
+ "class_name": "oceantracker.particle_statistics.gridded_statistics2D.GriddedStats2D_timeBased",
255
+ "calculation_interval": output_time_step,
256
+ "count_status_in_range": ["on_bottom", "on_bottom"],
257
+ "particle_property_list": [
258
+ "age_decay"
259
+ ],
260
+ "grid_size": [
261
+ grid_size,
262
+ grid_size
263
+ ]
264
+
265
+ }
266
+ ],
267
+ },
268
+ }
269
+
270
+ cases = []
271
+ for pen in list_of_pens:
272
+ case = create_case_dict_for_pen(pen["pen_position"],
273
+ pen["depth_range"])
274
+ cases.append(case[0])
275
+ cases.append(case[1])
276
+
277
+ params["case_list"] = cases
278
+
279
+ # %% [markdown]
280
+ # ## Run Model
281
+
282
+ # %%
283
+ print('Estimated output data size per case')
284
+ print('-----------------------------------')
285
+
286
+ print(f'\t{output_steps*grid_size**2*8*3/1024**3:.1f} GB')
287
+
288
+
289
+
290
+ time_per_particle_per_time_step = 2e-5
291
+ releases = model_duration/release_interval
292
+ time_steps_between_releases = release_interval/model_time_step
293
+
294
+ active_particles_per_time_step = np.array([0])
295
+ for ii in range(int(releases)):
296
+ active_particles_per_time_step= np.append(active_particles_per_time_step,
297
+ [active_particles_per_time_step[-1] + pulse_size]*int(time_steps_between_releases))
298
+
299
+ estimated_run_time = np.sum(active_particles_per_time_step*time_per_particle_per_time_step) #\wo io
300
+
301
+ print('Estimated compute time per case')
302
+ print('-----------------------------------')
303
+ print(f'\t{estimated_run_time/60/60:.0f}h')
304
+
305
+
306
+
307
+
308
+ # %%
309
+ path_to_output = os.path.join(
310
+ os.path.abspath(os.path.curdir),
311
+ params['shared_params']['root_output_dir'],
312
+ params['shared_params']['output_file_base'],
313
+ params['shared_params']['output_file_base']+'_runInfo.json')
314
+
315
+ # %%
316
+ try:
317
+ load_output_files.get_case_info_file_from_run_file(path_to_output)
318
+ except:
319
+ path_to_output = run(params)[0]
320
+
321
+ # %% [markdown]
322
+ # ## Post-Processing
323
+
324
+ # %% [markdown]
325
+ # ### Checking decay
326
+
327
+ # %%
328
+ decay = 0.087
329
+
330
+ t = np.arange(0, 3600*24*60, 3600*24)
331
+
332
+ x = np.exp(-t*feed_decay_rate)
333
+
334
+ plt.figure()
335
+ plt.plot(t/3600/24,x)
336
+ plt.grid(True, which="both")
337
+ plt.hlines(0.01, 0, 60, linestyles='dashed')
338
+
339
+
340
+ # %% [markdown]
341
+ # ### Feed
342
+
343
+ # %%
344
+ # loading feed case
345
+ case = load_output_files.get_case_info_file_from_run_file(path_to_output, ncase = 1)
346
+
347
+ # deposition in the model duration
348
+ stats_data = load_output_files.load_stats_data(case,nsequence=0)
349
+
350
+ # %%
351
+ # shit unit masses present at time step at cell on bottom
352
+ feed_unit_masses_present = stats_data['sum_age_decay']#['time', 'pen', 'x', 'y']
353
+ feed_unit_masses_present[np.isnan(feed_unit_masses_present)] = 0
354
+
355
+ # scale this with the gauge mass per particle
356
+ feed_present = feed_unit_masses_present * initial_shit_particle_mass
357
+
358
+ # calculate how much of this has decayed in this time step on bottom
359
+ feed_decayed = feed_present * feed_decay_rate * model_time_step
360
+
361
+ # %%
362
+ print(f"Total feed input into system: {feed_mass_dry:.2f} kg/a")
363
+ print(f"Total feed not consumed: {flux_feed:.2f} kg/a")
364
+ print(f"Total feed decayed on bottom (\wo equilibrium adjustment): {np.sum(feed_decayed):.2f} kg/a")
365
+ print(f"Total feed decayed on bottom (\w equilibrium adjustment): {np.sum(np.sum(feed_decayed[-1,0]*feed_decayed.shape[0])):.2f} kg/a")
366
+
367
+ # %%
368
+ plt.imshow(np.max(stats_data['sum_age_decay'][:,0,:,:],axis=(0)))
369
+ plt.colorbar()
370
+
371
+ # %% [markdown]
372
+ # ### Shit
373
+
374
+ # %%
375
+ # load shit case
376
+ case = load_output_files.get_case_info_file_from_run_file(path_to_output, ncase = 2)
377
+
378
+ # deposition in the model duration
379
+ stats_data = load_output_files.load_stats_data(case, var_list=['age_decay'], nsequence=0)
380
+
381
+ # %%
382
+ # shit unit masses present at time step at cell on bottom
383
+ shit_unit_masses_present = stats_data['count']#['time', 'pen', 'x', 'y']
384
+ shit_unit_masses_present[np.isnan(shit_unit_masses_present)] = 0
385
+
386
+ # scale this with the gauge mass per particle
387
+ shit_present = shit_unit_masses_present * initial_shit_particle_mass
388
+
389
+ # calculate how much of this has decayed in this time step on bottom
390
+ shit_decayed = shit_present * shit_decay_rate * model_time_step
391
+
392
+ # %%
393
+ print(f"Total feed input into system: {feed_mass_dry:.2f} kg/a")
394
+ print(f"Total shit input into system: {flux_shit:.2f} kg/a")
395
+ print(f"Total shit decayed on bottom (\wo equilibrium adjustment): {np.sum(shit_decayed):.2f} kg/a")
396
+ print(f"Total shit decayed on bottom (\w equilibrium adjustment): {np.sum(np.sum(shit_decayed[-1,0]*shit_decayed.shape[0])):.2f} kg/a")
397
+
398
+
399
+ # %%
400
+ plt.imshow(np.sum(shit_decayed[:,0,:,:],axis=0))
401
+ plt.colorbar(label="Shit decayed on bottom (kg/a)")
File without changes