Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
19b870d
Added the wait_for_commands and command_path options back to bdiana.
Dec 14, 2015
ccc63fc
Merge ../diana-head
ManelCeperuelo Dec 15, 2015
31fd0b2
Updated REAME.md file
ManelCeperuelo Dec 15, 2015
aca90d1
Updated REAME.md
ManelCeperuelo Dec 15, 2015
c408b65
Added < and > for table legend when using line.intervals
ManelCeperuelo Dec 17, 2015
472e0e8
Added < and > for table legend when using line.intervals
ManelCeperuelo Dec 17, 2015
5066fce
Merge ../diana-head
ManelCeperuelo Dec 21, 2015
05fd16a
Merge ../diana-head
ManelCeperuelo Jan 5, 2016
65c6105
Merge ../diana-head
ManelCeperuelo Jan 6, 2016
1538bc9
Merge ../diana-head
ManelCeperuelo Jan 14, 2016
e6ced23
Merge ../diana-head
ManelCeperuelo Jan 15, 2016
c15c1e7
Merge ../diana-head
ManelCeperuelo Jan 19, 2016
a747573
Merge ../diana-head
ManelCeperuelo Jan 25, 2016
35272e5
Merge ../diana-head
ManelCeperuelo Jan 27, 2016
5bcb11f
Merge ../diana-head
ManelCeperuelo Feb 1, 2016
b0f9663
Merge ../diana-head
ManelCeperuelo Feb 3, 2016
b7527bf
Merge ../diana-head
ManelCeperuelo Feb 19, 2016
13a5243
Merge ../diana-head
ManelCeperuelo Feb 25, 2016
66f1afd
Merge ../diana-head
ManelCeperuelo Mar 8, 2016
b109b7c
Merge ../diana-head
ManelCeperuelo Mar 15, 2016
dbd1e1e
Merge ../diana-head
ManelCeperuelo Apr 7, 2016
f8fc158
Merge ../diana-head
ManelCeperuelo Apr 11, 2016
78c2a11
Merge ../diana-head
ManelCeperuelo Apr 18, 2016
a668739
Merge ../diana-head
ManelCeperuelo Apr 25, 2016
097084e
Merge ../diana-head
ManelCeperuelo Apr 29, 2016
bd3aac5
Merge ../diana-head
ManelCeperuelo May 3, 2016
1aa3e13
Input files are removed with c library
ManelCeperuelo May 4, 2016
9e208fb
Added <iostream> header to compile with Ubuntu 16.04. The class could…
ManelCeperuelo May 4, 2016
bb0e233
Merge ../diana-head
ManelCeperuelo May 4, 2016
d9c3342
Merge ../diana-head
ManelCeperuelo May 9, 2016
7e20f0f
Merge ../diana-head
ManelCeperuelo May 13, 2016
6de9003
Merge ../diana-head
ManelCeperuelo May 19, 2016
120151e
Merge ../diana-head
ManelCeperuelo May 27, 2016
b6efa7e
Merge ../diana-head
ManelCeperuelo Jun 9, 2016
7ebf65a
Merge ../diana-head
ManelCeperuelo Jun 20, 2016
6ff4cbc
Merge ../diana-head
ManelCeperuelo Jun 27, 2016
2227317
Merge ../diana-head
ManelCeperuelo Jun 30, 2016
b072fc6
Merge ../diana-head
ManelCeperuelo Aug 12, 2016
2a71191
Merge ../diana-head
ManelCeperuelo Aug 16, 2016
869ae86
Merge ../diana-head
ManelCeperuelo Aug 22, 2016
b316400
Merge ../diana-head
ManelCeperuelo Aug 30, 2016
adef6e9
Merge ../diana-head
ManelCeperuelo Sep 23, 2016
253755a
Merge ../diana-head
ManelCeperuelo Sep 27, 2016
710b749
Merge https://github.com/metno/diana
ManelCeperuelo Oct 19, 2016
f5c652b
Merge https://github.com/metno/diana
ManelCeperuelo Nov 23, 2016
08a3b28
Merge https://github.com/metno/diana
ManelCeperuelo Dec 1, 2016
d182d19
Merge https://github.com/metno/diana
ManelCeperuelo Dec 14, 2016
abae617
Merge https://github.com/metno/diana
ManelCeperuelo Dec 15, 2016
c1a5360
Merge https://github.com/metno/diana
ManelCeperuelo Dec 16, 2016
749efc3
Merge https://github.com/metno/diana
ManelCeperuelo Dec 21, 2016
81a18c8
Merge https://github.com/metno/diana
ManelCeperuelo Dec 22, 2016
2d3896d
Merge https://github.com/metno/diana
ManelCeperuelo Jan 6, 2017
28f260b
Merge https://github.com/metno/diana
ManelCeperuelo Jan 24, 2017
aabd13d
Merge https://github.com/metno/diana
ManelCeperuelo Jan 26, 2017
47475e5
Merge https://github.com/metno/diana
ManelCeperuelo Feb 6, 2017
2b7dfc7
Merge https://github.com/metno/diana
Mar 22, 2017
39f4b3d
Merge https://github.com/metno/diana
Apr 4, 2017
a2ea997
Merge https://github.com/metno/diana
Apr 25, 2017
60aafbc
Merge https://github.com/metno/diana
May 15, 2017
7d1df85
Merge https://github.com/metno/diana
Jun 19, 2017
c6fd951
Merge https://github.com/metno/diana
Oct 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# DIANA

Diana is the core visualisation tool from MET Norway (Norwegian Meteorological
Institute) and is distributed under the GPL license. See gpl.txt for details
concerning the GPL license.
Diana is the core visualisation tool for StormGeo and is based on latest
release of DIANA from MET Norway (Norwegian Meteorological Institute) and is
distributed under the GPL license. See gpl.txt for details concerning the
GPL license.

Diana is a graphical viewer and editor developed for use with meteorological
and oceanographic data. It uses OpenGL and/or Qt for the graphics and Qt for
Expand Down Expand Up @@ -66,9 +67,9 @@ http://creativecommons.org/licenses/by/3.0/ page for the license terms.

## Contact

Norwegian Meteorological Institute (met.no)
Box 43 Blindern
0313 OSLO
StormGeo Group HQ
Nordre Nøstekaien 1
5011 Bergen
NORWAY

email:[email protected]
email:[email protected]
115 changes: 114 additions & 1 deletion src/bdiana_capi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ const std::string com_plotend = "plot.end";

const std::string com_print_document = "print_document";

const std::string com_wait_for_commands = "wait_for_commands";
const std::string com_wait_end = "wait.end";

const std::string com_setupfile = "setupfile";
const std::string com_command_path = "command_path";
const std::string com_buffersize = "buffersize";

const std::string com_papersize = "papersize";
Expand Down Expand Up @@ -1102,6 +1106,20 @@ static void printUsage(bool showexample)
"# You can not mix map plots, cross sections or soundings in one file",
"#",
"#- Use of alpha-channel blending is not supported in postscript",
"#-------------------------------------------------------------- \n"
"#* Interactive batch-plotting * \n"
"# To make plots on-demand, you will find this feature useful. \n"
"# Put this in the input-file: \n"
"# command_path=<some_path> \n"
"# wait_for_commands \n"
"# and bdiana will wait at the \'wait_for_commands\' line, periodically\n"
"# checking \'<some_path>\' for a matching filename. When found, the \n"
"# file(s) are read and the instructions within executed. If the line:\n"
"# wait.end \n"
"# is encountered, bdiana will stop waiting for commands. \n"
"# The \'command_path\' must specify a complete filename - optionally \n"
"# with wildcards. Example: \'/tmp/*.txt\' \n"
"# NB: all files found are deleted immediately after reading. \n"
"#--------------------------------------------------------------",
"#* Get Capabilities *",
"# Developed for use in WMS",
Expand Down Expand Up @@ -2201,6 +2219,93 @@ static int handlePrintDocument(int& k)
return res;
}

static int handleWaitForCommands(int& k, int& linenum)
{
if (command_path.empty()) {
METLIBS_LOG_ERROR("ERROR, wait_for_commands found, but command_path not set");
return 1;
}
static int prev_iclock = -1;
int iclock;
float diff = 0;
miTime nowtime = miTime::nowTime();

// using clock-cycle-command
iclock = clock();
if (prev_iclock > 0)
diff = float(iclock - prev_iclock) / float(CLOCKS_PER_SEC);

METLIBS_LOG_INFO("================ WAIT FOR COMMANDS, TIME is:" << nowtime
<< ", seconds spent on previous command(s):" << diff);

std::string pattern = command_path;
vector<std::string> newlines;
std::string waitline = com_wait_for_commands;

diutil::string_v matches;
while ((matches = diutil::glob(pattern)).empty())
pu_sleep(1);

nowtime = miTime::nowTime();
prev_iclock = clock();
METLIBS_LOG_INFO("================ FOUND COMMAND-FILE(S), TIME is:" << nowtime);

vector<std::string> filenames;

//loop over files
for (diutil::string_v::const_iterator it = matches.begin(); it != matches.end(); ++it) {
const std::string& filename = *it;
METLIBS_LOG_INFO("==== Reading file: '" << filename << "'");
filenames.push_back(filename);
ifstream file(filename.c_str());
while (file) {
std::string str;
if (getline(file, str)) {
miutil::trim(str);
if (str.length() > 0 && str[0] != '#') {
if (miutil::contains(miutil::to_lower(str), com_wait_end))
waitline = ""; // blank out waitline
else
newlines.push_back(str);
}
}
}
}
// remove processed files
/*
for (unsigned int ik = 0; ik < filenames.size(); ik++) {
ostringstream ost;
ost << "rm -f " << filenames[ik];
std::string command = ost.str();

METLIBS_LOG_INFO("==== Cleaning up with: '" << command << "'");
int res = system(command.c_str());

if (res != 0){
METLIBS_LOG_WARN("Command:" << command << " failed");
}
}
*/
for (unsigned int ik = 0; ik < filenames.size(); ik++) {
ostringstream ost;
ost << filenames[ik];
std::string command = ost.str();
METLIBS_LOG_INFO("==== Cleaning up with: '" << command << "'");
if( remove( command.c_str() ) != 0 )
METLIBS_LOG_WARN("Error deleting file: '" << command << "'");
}

// add new wait-command
if (waitline.size() > 0)
newlines.push_back(waitline);
// insert commandlines into the command-queue
lines.erase(lines.begin() + k, lines.begin() + k + 1);
lines.insert(lines.begin() + k, newlines.begin(), newlines.end());
linenum = lines.size();
k--;
return 0;
}

static int handleFieldFilesCommand(int& k)
{
bool found_end = false;
Expand Down Expand Up @@ -2598,7 +2703,7 @@ static int parseAndProcess(istream &is)
if (res != 0)
return res;

const int linenum = lines.size();
int linenum = lines.size();

// parse input - and perform plots
for (int k = 0; k < linenum; k++) {// input-line loop
Expand Down Expand Up @@ -2647,6 +2752,11 @@ static int parseAndProcess(istream &is)
return 99;
continue;

} else if (command == com_wait_for_commands) {
if (handleWaitForCommands(k, linenum) != 0)
return 99;
continue;

} else if (command == com_field_files) {
if (handleFieldFilesCommand(k) != 0)
return 99;
Expand Down Expand Up @@ -2697,6 +2807,9 @@ static int parseAndProcess(istream &is)
return 99;
}

} else if (key == com_command_path) {
command_path = value;

} else if (key == com_buffersize) {
if (handleBuffersize(k, value))
return 99;
Expand Down
8 changes: 7 additions & 1 deletion src/diFieldPlot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,13 @@ void FieldPlot::getTableAnnotations(vector<string>& annos)
float min = poptions.linevalues[i];
float max = poptions.linevalues[i + 1];
ostringstream ostr;
ostr << min << " - " << max << unit;
//ostr << min << " - " << max << unit;
// Check for "less than" legend
if (i==0 && min==-fieldUndef) {
ostr << " < " << max << unit;
} else {
ostr << min << " - " << max << unit;
}
vtable[i].text = ostr.str();
}
float min = poptions.linevalues[ncodes - 1];
Expand Down
8 changes: 8 additions & 0 deletions src/diPlotOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,14 @@ vector<float> PlotOptions::autoExpandFloatVector(const std::string& str)
}

// try to add a whole interval (10,20,...50)
//-----------------------------------
// Check here for 2 dots
//-----------------------------------
if (!values.size() and strcmp(t.c_str(),"..")==0) {
values.push_back(-fieldUndef);
continue;
}
//-----------------------------------

if (values.size() < 2) {
METLIBS_LOG_DEBUG("need 2 values yet to define step size");
Expand Down
1 change: 1 addition & 0 deletions src/diPrintOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define MILOGGER_CATEGORY "diana.PrintOptions"
#include <miLogger/miLogging.h>

#include <iostream>
using namespace d_print;
using namespace::miutil;
using namespace std;
Expand Down