Skip to content

Refactoring #37

@gmaze

Description

@gmaze

Let's talk about refactoring ideas

Configuration:

This is the most important feature to properly control what's being done, so it requires a nice and flexible UI

  • Better distinguish Analysis parameters (eg: use_pv) from Local configuration settings (eg: path and folder/file names)
  • Getter, setter for configuration items
  • Loader, saver from/to files (using txt files compatible with the Matlab software)
  • Usable in context ("with") or for sessions
  • Consistency/validity checks (e.g. Setting warning in configurations to prevent entry of swapped values  #28 )

Data Mapping:

This is the most time consuming step, so it requires optimization to improve perf

  • Reduce the size of the update_salinity_mapping function (500 hundreds line !) by identifying recurrent patterns and affecting inner loop work to specific functions
  • Consider using xarray to make management of group of variables much easier. Together with a more readable code, this should help in recurrent task like modification of variable batches.
  • update_salinity_mapping has 2 main loop levels: on profile and on vertical levels. If inner loop work is delegated to functions and if data structure is clarified (with dictionaries or even better: xarray.DataSet), make these loops work in parallel will be much easier and a game changer in terms of performances.

Data fetching:

This is a key component of the software, fetching float but more importantly reference data.

  • Refactor all functions dedicated to data fetching to a single module (already started in [WIP] Refactor software: step 1 #26 but surely not finished)
  • Consider using a cache filesystem to avoid repeating previous fetch
  • When this will be possible, consider fetching data from web-API: always up to date !

Code design:

  • Refactor code so that functions are really self contained: eg in update_salinity_mapping the longitude values wrapping between -180/180 for get_topo_grid is done outside of get_topo_grid, adding 4 lines and 1 variable to the code. It it this function inner responsibility to check for longitude values, must not be done outside.
  • Start a documentation, getting started with sphinx autodoc. Will make refactoring easier to be able to navigate the code.
  • This is linked to documentation: gives clear explanation of configuration parameters and where they are used in the code. This will also help users to set up the software properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority-lowLow priority for next releaserefactoringimprove the design, structure, and/or implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions