frabas / displace_gui Goto Github PK
View Code? Open in Web Editor NEWA Scientific Research Software for Spatial Fisheries and Natural Resource Management
Home Page: https://displace-project.org/
License: GNU General Public License v2.0
A Scientific Research Software for Spatial Fisheries and Natural Resource Management
Home Page: https://displace-project.org/
License: GNU General Public License v2.0
This branch is a copy of master commit b37cac9, created on 08/04/2021. I will implement the following changes, all realted to SSM assumptions: - beta formula in main.cpp around l1082 (change the forcing DONE AND CORRECTED WEIRD INDEXING< TO BE PROOFREAD) - background mortality in Node.cpp around l1461 (change the forcing DONE) - predkernel formula main.cpp around l1085 (update DONE) Find your way with DISPLACE ====== ## Summary - [What is for?](#what-is-for) - [How to contribute](#how-to-contribute) - [How to install](#how-to-install) - [Quick start for running a DISPLACE simulation](#quick-start-for-running-a-displace-simulation) - [Simulation output formats](#simulation-output-formats) - [How to build from scratch](#how-to-build-from-scratch) - [DISPLACE doxygen documentation](#displace-doxygen-documentation) - [GDAL notes](#gdal-notes) - [Unit testing](#unit-testing) - [Build a new case study](#build-a-new-case-study) - [How to cite](#how-to-cite) ## What is for? DISPLACE is a dynamic, individual-based model for spatial fishing planning and effort displacement integrating underlying fish population models. The DISPLACE project develops and provides a platform primarily for research purposes to transform the fishermen detailed knowledge into models, evaluation tools, and methods that can provide the fisheries with research and advice. By conducting a ecological and socio-economic impact assessment the model intends to serve as an aid to decision-making for (fishery) managers. An impact assessment will help answering on what are the impacts of the different policy options and who will be affected. By quantifying the effects the assessment will measure how the different options compare, for example how different the options perform in achieving the objective(s) of the policy. ## How to contribute [Please read our CONTRIBUTING statement here](CONTRIBUTING.md) ## How to install DISPLACE Look at the [Release section](https://github.com/frabas/DISPLACE_GUI/releases) on this GitHub repository to download an installer for Windows. Alternatively, look at the [google drive for DISPLACE](https://drive.google.com/drive/folders/0ByuO_4j-1PxtfnZBblpQNmh2a2Z4SmpkRC16T1kwR0t1RWUyOVUxdHlEZzZwZWVpaVJac00) for Unix or MacOSX packages, also hosting additional files i.e. possible dependencies and the DISPLACE software development kit. ### Install on Windows Launch the installer application, and follow the guide. There are no prerequisites on Windows, and the application should work out of the box. ### Install on MacOS Open the DMG file, then drop the program in the Application folder. There are no prerequisites on MacOS, and the application should work out of the box. ### Install on Ubuntu Linux Ubuntu 18.04LTS has a few prerequisites that must be installed before installing the displace package itself. Run the following command to install the prerequisites: ```bash $ sudo apt install libgdal20 libgdal-dev libcgal13 libcgal-dev libboost1.65-all-dev libgeographic17 libqt5gui5 libqt5widgets5 libqt5xml5 ``` Then install the `msqlitecpp` packages provided in the download section: ```bash $ sudo dpkg -i msqlitecpp0_0.9.4_amd64.deb msqlitecpp-dev_0.9.4_amd64.deb ``` Finally, install the displace package: ```bash $ sudo dpkg -i displace_0.9.22_amd64.deb ``` If you have any difficulty, try fixing the package dependencies by running: ```bash $ sudo apt --fix-broken install ``` Any missing package should be automatically installed. ## How to compile from the code source [compiling with CMake (preferred)](docs/Building-cmake.md) [compiling on HPC (simulator only)](docs/Building-on-hpc.md) [making the displace sdk (optional)](docs/building.md) [compiling on Windows (deprecated)](docs/Building.win) [compiling on Unix deprecated)](docs/Building.unix) [compiling on MacOSX deprecated)](docs/Building.MacOSX) ## DISPLACE doxygen documentation Can be found [here](https://frabas.github.io/DISPLACE_GUI/doxygen/doc/html/index.html) Procedure for updating the doxygen documentation without keeping track of git history [here](https://github.com/robotology/how-to-document-modules/blob/master/README.md) ## Quick start for running a basic DISPLACE simulation [DISPLACE Example datasets](https://displace-project.org/blog/download/) are available for download. You need to unzip the downloaded file to a folder that name the dataset with the pattern DISPLACE_input_xx, for example DISPLACE_input_minitest which is the minimal dataset typically used for demonstration purpose. Run DISPLACE with e.g. displacegui By default the Model Objects is set to 4. If you want to run a scenario, first make sure your Model Objects is set to [0]. ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_select_model_0.png) If yes then in the main menu do a "File">"Load a Scenario Model, ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_load_scenario_file.png) and choose a scenario file (a .dat file) you´ll find in the\simusspe subfolder of your DISPLACE dataset. Select the file, click Ok and wait to see the DISPLACE graph plotted on the map. ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_scenario_file_is.png) You can now click Start in the DISPLACE command panel for a DISPLACE simulation to start: ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_click_start.png) After some object creation and initialization the time step window will shortly update and the simulation run to the end time step. By default, 8762 hourly time steps will be simulated which is approx. the number of hours in one year. in Setup menu the total number of time step can be changed to up to 52586 for a maximal 6-years horizon. Because of the computation time, running more than one year simulation and many replicates are better done on a HPC cluster. Automated shell scripts to run many DISPLACE simulations in parallel on a HPC cluster can be provided on request. ## Simulation output formats Look at the [description](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/output_fileformats.md) of the list of files produced by a DISPLACE simulation. A [displaceplot](https://github.com/frabas/displaceplot/releases) R package has been developed to handle these output text files and produced some plots out of them. Simulation outcomes are also exported as a SQLite database which can be re-loaded within DISPLACE in a Replay mode. The internal structure and simulated data can be further retrieved from the database when using an external SQLite DB browser. To load a result database into DISPLACE: ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_load_db_menu.png) Select a DISPLACE db file: ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_load_db_file.png) Once loaded, the simulation can be replayed with the Replay command: ![alt text](https://github.com/frabas/DISPLACE_GUI/blob/master/docs/quickstart_replay_command.png) ## GDAL Notes Current version of QMapControl supports shapefiles loading ONLY for WGS84 Coordinates system. This is because QMapControl itself uses WGS84 coordinates. So you need to convert your shapefiles if not using this CRS. You can use ogr2ogr or the provided script in the scripts/ directory. $ ogr2ogr -t_srs WGS84 DEST.shp SRC.shp Note that DEST file is specified before the source! ## Unit testing Unit testing is performed using the Boost::Test framework. It can be compiled and linked in two ways: - Dynamic linked, using the system installed boost::test library. This option is enabled by default on Unix - Compiled in, using the boost/test/included/unit_test.hpp (included in main.cpp). This is suitable for Windows, where boost::test is not available with our version of mingw64. A standard installation of boost::test is required. The two methods can be selected by defining boost_test_included in the CONFIG line of the Qt Project. It is enabled by default on Windows (see localconfig.pri). If boost::test is not available in any form, it can be disabled by removing the units-test option from the CONFIG variable in the pro file. ## Build a new case study A set of [R routines](https://github.com/frabas/DISPLACE_R_inputs) are available to create a new DISPLACE case study from scratch. These routines are quite data-hungry and would require to be adapted to each case. Ideally a R package should be build soon to wrap them in a consistent tool. Another way is to scrutinize the DISPLACE_input_mintest github repository to see all the required input files required to run a minimal case study. Because it can be currently tricky to understand the logic behind all the input text files we will think one day to build a unique input database to DISPLACE instead of using so many individual text files. ## How to cite * Bastardie F, Nielsen JR, Miethe T. 2014. DISPLACE: a dynamic, individual-based model for spatial fishing planning and effort displacement - integrating underlying fish population models. Canadian Journal of Fisheries and Aquatic Sciences. 71(3):366-386. [link here](https://www.nrcresearchpress.com/doi/full/10.1139/cjfas-2013-0126#.XJs-ubh7nmE) * Bastardie, F., Nielsen, J. R., Eigaard, O. R., Fock, H. O., Jonsson, P., and Bartolino, V. Competition for marine space: modelling the Baltic Sea fisheries and effort displacement under spatial restrictions. ICES Journal of Marine Science, doi: 10.1093/icesjms/fsu215. [link to a free copy](https://academic.oup.com/icesjms/article/72/3/824/701817) * Bastardie, F., Nielsen, J. R., Eero, M., Fuga, F. Rindorf., A. 2017. Effects of changes in stock productivity and mixing on sustainable fishing and economic viability, ICES Journal of Marine Science, Volume 74, Issue 2, Pages 535–551 [link to a free copy](https://academic.oup.com/icesjms/article/74/2/535/2669542) * Bastardie, F., Angelini, S., Bolognini, L., Fuga, F., Manfredi, C., Martinelli, M., Nielsen, J. R., Santojanni, A., Scarcella, G., and Grati, F.. 2017. Spatial planning for fisheries in the Northern Adriatic: working toward viable and sustainable fishing. Ecosphere 8( 2):e01696. [link to a free copy](https://esajournals.onlinelibrary.wiley.com/doi/full/10.1002/ecs2.1696)
...at least on Windows. for example the ui crashes as soon as a graph file is missing but no e.g. QMessageBox is popping up to inform the user with the problematic reading.......
Using -1 as "invalid" values makes things more complex in SQL. Use NULL instead.
When the version is outdated, the tables cannot be created/loaded and app must not crash.
Actually during simulation running, the plot is updated everytime the simulator signals a change to the upper gui.
For optimization purposes, the gui should only set the plot as dirty, and update it only when focused, or immediately only for displayed plots.
This affects only debug mode compilation, because in release asserts are no-op.
mFeedback->setMax() (graphbuilderworker.cpp line 12) tries to update the gui while in a non-gui thread, this shouldn't be done.
Add a transaction complete after the end of the simulation loop. Otherwise the steps between the last commit and the end of the simulation wont be committed.
Parse the application name to add it to the db when loading (right now: only simu 2 is written in the Model Objects Window)
OutputFileParser depends from output files on text format (original version).
It should be nice to remove it.
But removing it also requires the simulator to signals the gui which part of the db has been updated, to avoid reloading all the nodes data.
See #110 and comments.
To do: retrieve the fishing pressure (swept area) from the Vessel::do_catch () and export it like other output layers, also into the statistic windows.
Symbol size on map hardcoded to 30 for Windows
The exception must be catched before the threads exit.
This would require a big refactoring of all .pro files, but:
Needs a deep evaluation before starting this task.
Due to a race condition on exit, the Map thread doesn't exit before the main thread completes.
On Windows this makes the app hang, on Linux/MacOS this generate a crash report.
avifieldupdater and avifieldshuffler (and perhaps vmsmerger) could be merged in a single command line tool - or perhaps rewrite them in python or other scripting tools?
Ships
tracking for emissions of SOx NOx CO2 and PM (fine particles)
tracking for transported tonnage
etc.
Fishframs
tracking for input nutrients
tracking for farmed fish production
etc.
First of all it is not clear how and why it is possible to load a harbour file (name/idx) when the Graph is empty!! Where are the coordinates of the added icons for harbours on the map coming from? Is the loader looking for a graph coord.dat in the path? or in the name_harbours.dat file?
Currently the expected file (names_harbours.dat) for Load Harbour is already aware of the Graph node idx e.g.:
9866 Kappeln
9895 Århus
9898 Vedbæk
9899 Bogense
9903 København
9905 Egernsund
9905 NA22
9909 Gilleleje
etc.
it would actually be better and more natural to directly load some harbours file with lat long and then the ui has to add a node for each harbour to the new graph (therefore also adding them to the end of the coord,dat file) ....before creating the additional edges to link all the harbour nodes to the graph.
Then the input file (harbours.dat) could be instead:
name;x;y;idx.port
Baabe (Ostseebad);13.715744;54.362458;1
Barth;12.72666667;54.37166667;2
Bensersiel;7.575;53.675;3
Brake;8.483333333;53.33333333;4
Bremerhaven;8.573333333;53.53666667;5
Burgstaaken/Fehmarn;9.156246;53.896146;6
Büsum;8.85;54.13333333;7
etc.
While compiling on HPC we need to remove some function (ipc), and on MacOS and Windows we must remove the crash handler and other stuff.
We could instead check for certain header files and add proper definitions/libraries/whatever to avoid requiring he user to manually do this.
We can still leave the options. But ideally a simple CMake
call without any definition should correctly compile under every platform (linux, windows, MacoS, hpc).
It seems that WIndows and MacOS application icons differs. Check this.
Also check the .desktop fail for linux.
A nice small feature to have in the Object Editor would be to add an option on the first ui for the user to choose the type of the separator in use for the .csv file before diplaying them. Because it could be either a comma or a semi-colon depending on the region and users.....
A potential double free / memory leak bug is present in MapObjectController.cpp line 321:
OGRSFDriverRegistrar::Open
will return a static allocated pointer that must be released using ReleaseDataSource
, and not a shared_ptr as currently done.
To avoid mixing decision trees that evaluate based on time (tstep) with those based on Fishing Grounds (fground), we should use different Abstract Nodes.
See VesselsEvaluators.h
...while the db is ok because can be loaded from a fresh DISPLACE GUI start
Commit rate in simulation is hardwired to 100, it would be nice to have the possibility to fine tune it with a proper command line option:
--commit-rate 250
Will commit the changes every 250 steps.
Needs boost::program_option
so it depends on #87
...and open and set up the AGraph field accordingly (maybe also the N Row Coord and N Row Graph if the user actually removed some nodes!) in the Scenario ui and save and close, also forcing another name, for example baseline_graphXX.
detect all the nodes included in the polygons of the shape file and then assign the penalty to them. We should be able to repeat this for different shapefiles sequentially.
change read_scenario_config_file() so that
For example, currently we have:
baseline TACs LTMP
baseline
1
etc.
The idea would be to replace by
dyn_alloc_sce baseline TACs LTMP
dyn_pop_sce baseline
biolsce 1
with a keyword in first position
then read_scenario_config_file() could detect the keywords line by line and redirected the reading in the right variable. While the comments are just ignored...
then make possible different orders to limit mistakes in input e.g.
biolsce 1
dyn_pop_sce baseline
dyn_alloc_sce baseline TACs LTMP
Size is too large by default, creating symbol overlap.
When updating the vessel status, only tstep== x is used. Must load just one row with tstep <= x instead.
The editor should be able to generate (or complete) all the vesselsspe files from the editor, e.g. list of fgrounds and proba of visits from a geospatial shape file layer, etc. and copy/paste the info for a bunch of vessels...
Fix the calendar display in replay mode. e.g. the month Mt keeps 0 even if should be incremented to 1 when tstep>745 etc.
....currently the tariff map is at the overall level. We actually need a tariff map for each metier (i.e. each node has a vector for tariffs with as many elements as the number of metiers)...
If Load() fails (for example because a file is missing), instead of showing a msg box, the program crashes.
The problem is that DisplaceModel runs a thread (mParserThread) in the constructor. This thread isn't stopped before destroying the object (the implicit destructor is used) so the program crashes.
Solutions: Either don't start the parser thread in the constructor, or stop it in the destructor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.