[metview] 17/20: new upstrean release 4.7.2
Alastair McKinstry
mckinstry at moszumanska.debian.org
Sat Oct 29 13:50:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to tag debian/4.7.2-1
in repository metview.
commit 8449a61bf72dec126d62d93700b4c2f5024c1074
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Sun Oct 23 12:31:57 2016 +0100
new upstrean release 4.7.2
---
CMakeLists.txt | 2 +-
VERSION.cmake | 2 +-
VERSION.cmake => VERSION.cmake.orig | 8 +-
.../app-defaults/FrameKeyProfile_default.xml | 4 +-
.../app-defaults/GribKeyProfile_default.xml | 4 +-
.../app-defaults/LayerKeyProfile_default.xml | 2 +-
share/metview/etc/GeoViewDef | 2 +-
share/metview/etc/{GeoViewDef => GeoViewDef.orig} | 7 +-
share/metview/etc/MCOASTDef | 176 ++++++++---------
share/metview/etc/MarsRules | 9 -
share/metview/etc/ecmwf.def | 9 +-
share/metview/etc/mars.chk | 9 -
share/metview/etc/tigge.def | 18 +-
src/Desktop/MvQFolderModel.cc | 14 +-
src/Hovmoeller/HovArea.cc | 3 +-
src/Hovmoeller/HovHeight.cc | 3 +-
src/Hovmoeller/HovLine.cc | 3 +-
src/Hovmoeller/HovToolkit.cc | 9 +-
src/Hovmoeller/MHovmoellerDataDef | 4 +-
src/Hovmoeller/MHovmoellerViewDef | 2 +-
src/Macro/bufr.cc | 5 +
src/Macro/grib.cc | 55 +++---
src/Macro/include/value.h | 57 ++++--
src/Macro/main.cc | 51 ++---
src/Macro/request.cc | 19 +-
src/Macro/value.cc | 2 +-
src/XSection/MVProfileViewDef | 2 +-
src/XSection/MXAverageDef | 2 +-
src/XSection/MXAverageViewDef | 10 +-
src/XSection/MXSectionViewDef | 8 +-
src/XSection/Xsect.cc | 4 +-
src/libMetview/MvFieldSet.cc | 2 +-
src/libMetview/MvRequest.cc | 19 +-
src/libMetview/MvRequest.h | 3 +
src/libMetview/MvScanFileType.cc | 3 +
src/libMvQtGui/MvQAbstractMessageExaminer.cc | 1 -
src/libMvQtGui/MvQFileInfoLabel.cc | 218 ++++++++++-----------
src/libMvQtUtil/CMakeLists.txt | 1 +
src/libMvQtUtil/MvQFileInfo.cc | 61 ++++++
src/libMvQtUtil/MvQFileInfo.h | 33 ++++
src/libUtil/CMakeLists.txt | 3 +-
src/libUtil/MvFileInfo.cc | 113 -----------
src/libUtil/MvFileInfo.h | 42 ----
src/libUtil/MvPath.cc | 64 +++++-
src/libUtil/MvPath.hpp | 2 +
src/uPlot/HovmoellerView.cc | 3 +-
src/uPlot/MvIconDataBase.cc | 62 +++---
test/data/hindcast.grib | Bin 0 -> 9360 bytes
test/macros/CMakeLists.txt | 3 +-
test/macros/grib_dates.mv | 95 +++++----
test/macros/plot_coast_order.mv | 1 -
51 files changed, 662 insertions(+), 572 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6adf3c5..87b67ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -327,7 +327,7 @@ endif()
ecbuild_use_package( PROJECT libemos VERSION 4.0.5 REQUIRED )
if(ENABLE_PLOTTING)
- ecbuild_use_package( PROJECT magics VERSION 2.24.3)
+ ecbuild_use_package( PROJECT magics VERSION 2.24.4)
if( MAGICS_FOUND )
set(MAGICS_LIB_DIR "${magics_BASE_DIR}/lib")
diff --git a/VERSION.cmake b/VERSION.cmake
index 8fadc4b..8b237ab 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,5 +1,5 @@
set(${PROJECT_NAME}_MAJOR_VERSION_STR "4")
set(${PROJECT_NAME}_MINOR_VERSION_STR "7")
-set(${PROJECT_NAME}_REVISION_VERSION_STR "0")
+set(${PROJECT_NAME}_REVISION_VERSION_STR "2")
set(${PROJECT_NAME}_VERSION_STR "${${PROJECT_NAME}_MAJOR_VERSION_STR}.${${PROJECT_NAME}_MINOR_VERSION_STR}.${${PROJECT_NAME}_REVISION_VERSION_STR}")
diff --git a/VERSION.cmake b/VERSION.cmake.orig
similarity index 61%
copy from VERSION.cmake
copy to VERSION.cmake.orig
index 8fadc4b..26351c4 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake.orig
@@ -1,5 +1,11 @@
+<<<<<<< HEAD
+set(${PROJECT_NAME}_MAJOR_VERSION_STR "5")
+set(${PROJECT_NAME}_MINOR_VERSION_STR "0")
+set(${PROJECT_NAME}_REVISION_VERSION_STR "0")
+=======
set(${PROJECT_NAME}_MAJOR_VERSION_STR "4")
set(${PROJECT_NAME}_MINOR_VERSION_STR "7")
-set(${PROJECT_NAME}_REVISION_VERSION_STR "0")
+set(${PROJECT_NAME}_REVISION_VERSION_STR "2")
+>>>>>>> release/4.7.2
set(${PROJECT_NAME}_VERSION_STR "${${PROJECT_NAME}_MAJOR_VERSION_STR}.${${PROJECT_NAME}_MINOR_VERSION_STR}.${${PROJECT_NAME}_REVISION_VERSION_STR}")
diff --git a/share/metview/app-defaults/FrameKeyProfile_default.xml b/share/metview/app-defaults/FrameKeyProfile_default.xml
index 0ef38d7..00b9ee9 100644
--- a/share/metview/app-defaults/FrameKeyProfile_default.xml
+++ b/share/metview/app-defaults/FrameKeyProfile_default.xml
@@ -2,10 +2,10 @@
<Profile name="System::Default">
<Key name="MV_Frame" shortName="Frame" desc="Frame index"/>
<Key name="shortName" shortName="Name" desc=""/>
- <Key name="date" shortName="Date" desc=""/>
+ <Key name="dataDate" shortName="Date" desc=""/>
<Key name="time" shortName="Time" desc=""/>
<Key name="stepRange" shortName="Step" desc=""/>
<Key name="level" shortName="Level" desc=""/>
<Key name="levelType" shortName="LevType" desc=""/>
</Profile>
-</MetviewKeyProfile>
\ No newline at end of file
+</MetviewKeyProfile>
diff --git a/share/metview/app-defaults/GribKeyProfile_default.xml b/share/metview/app-defaults/GribKeyProfile_default.xml
index a0e0725..911bedf 100644
--- a/share/metview/app-defaults/GribKeyProfile_default.xml
+++ b/share/metview/app-defaults/GribKeyProfile_default.xml
@@ -2,10 +2,10 @@
<Profile name="System::Default">
<Key name="MV_Index" shortName="Index" desc="Message index"/>
<Key name="shortName" shortName="Name" desc=""/>
- <Key name="date" shortName="Date" desc=""/>
+ <Key name="dataDate" shortName="Date" desc=""/>
<Key name="time" shortName="Time" desc=""/>
<Key name="stepRange" shortName="Step" desc=""/>
<Key name="level" shortName="Level" desc=""/>
<Key name="levelType" shortName="LevType" desc=""/>
</Profile>
-</MetviewKeyProfile>
\ No newline at end of file
+</MetviewKeyProfile>
diff --git a/share/metview/app-defaults/LayerKeyProfile_default.xml b/share/metview/app-defaults/LayerKeyProfile_default.xml
index bf44624..455bce2 100644
--- a/share/metview/app-defaults/LayerKeyProfile_default.xml
+++ b/share/metview/app-defaults/LayerKeyProfile_default.xml
@@ -14,7 +14,7 @@
</Key>
<Key name="scaling_formula" shortName="Scaling"/>
<Key name="scaled_units" shortName="Scaled units"/>
- <Key name="date" shortName="Date">
+ <Key name="dataDate" shortName="Date">
<Data source="gribapi"/>
</Key>
<Key name="time" shortName="Time">
diff --git a/share/metview/etc/GeoViewDef b/share/metview/etc/GeoViewDef
index 24bc789..238f873 100644
--- a/share/metview/etc/GeoViewDef
+++ b/share/metview/etc/GeoViewDef
@@ -18,8 +18,8 @@ GEOVIEW; GEOVIEW; UPLOT
CYLINDRICAL ; CYLINDRICAL
BONNE
COLLIGNON
- EPSG:32661
EPSG:4326
+ EPSG:3857
GEOS
GOODE
LAMBERT
diff --git a/share/metview/etc/GeoViewDef b/share/metview/etc/GeoViewDef.orig
similarity index 95%
copy from share/metview/etc/GeoViewDef
copy to share/metview/etc/GeoViewDef.orig
index 24bc789..9c86c3a 100644
--- a/share/metview/etc/GeoViewDef
+++ b/share/metview/etc/GeoViewDef.orig
@@ -18,8 +18,13 @@ GEOVIEW; GEOVIEW; UPLOT
CYLINDRICAL ; CYLINDRICAL
BONNE
COLLIGNON
- EPSG:32661
+<<<<<<< HEAD
+ EPSG4326
+ EPSG3857
+=======
EPSG:4326
+ EPSG:3857
+>>>>>>> release/4.7.2
GEOS
GOODE
LAMBERT
diff --git a/share/metview/etc/MCOASTDef b/share/metview/etc/MCOASTDef
index 61dcf23..d223844 100644
--- a/share/metview/etc/MCOASTDef
+++ b/share/metview/etc/MCOASTDef
@@ -204,112 +204,112 @@ MCOAST; Magics; Automatically generated
MAP_ADMINISTRATIVE_BOUNDARIES_COUNTRIES_LIST [ help = help_multiple_selection, exclusive = False ]
{
- ANGOLA;AGO
+ AFGHANISTAN;AFG
ALGERIA;DZA
- EGYPT;EGY
+ ANGOLA;AGO
+ ARGENTINA;ARG
+ AUSTRALIA;AUS
+ AUSTRALIA CCK;CCK
+ AUSTRALIA CXR;CXR
+ AUSTRALIA HMD;HMD
+ AUSTRALIA NFK;NFK
+ AUSTRIA;AUT
+ BAIKONUR COSMODROME;RUS
BANGLADESH;BGD
- NAMIBIA;NAM
+ BELARUS;BLR
BOLIVIA;BOL
- GHANA;GHA
- AUSTRALIA CCK;CCK
- PAKISTAN;PAK
- LIBYA;LBY
- MALAYSIA;MYS
- KOREA NORTH;PRK
- TANZANIA;TZA
BOTSWANA;BWA
- PARAGUAY;PRY
- SAUDI ARABIA;SAU
- MAURITANIA;MRT
+ BRAZIL;BRA
+ CAMEROON;CMR
+ CANADA;CAN
+ CENTRAL AFRICAN REPUBLIC;CAF
+ CHAD;TCD
CHILE;CHL
CHINA;CHN
- LAOS;LAO
- UNITED KINGDOM GIB;GIB
- GUINEA;GIN
- FINLAND;FIN
- URUGUAY;URY
- NEPAL;NPL
- AUSTRALIA CXR;CXR
- MOROCCO;MAR
- YEMEN;YEM
- SOUTH AFRICA;ZAF
- TOGO;TGO
- SYRIA;SYR
- KAZAKHSTAN;KAZ
+ COLOMBIA;COL
+ CONGO BRAZZAVILLE ;COG
CONGO KINSHASA ;COD
- NIGERIA;NGA
- ZIMBABWE;ZWE
- UNITED KINGDOM;GBR
- GUYANA;GUY
- MYANMAR;MMR
- CAMEROON;CMR
- TURKMENISTAN;TKM
- AUSTRALIA HMD;HMD
- CHAD;TCD
- ROMANIA;ROU
- MONGOLIA;MNG
- AFGHANISTAN;AFG
- AUSTRALIA NFK;NFK
- BELARUS;BLR
- FINLAND ALA;ALA
- GREECE;GRC
- MOZAMBIQUE;MOZ
- TAJIKISTAN;TJK
- INDIA;IND
+ CUBA;CUB
CZECH REPUBLIC;CZE
- ISRAEL;ISR
- PERU;PER
- INDONESIA;IDN
- VANUATU;VUT
- SURINAME;SUR
- CONGO BRAZZAVILLE ;COG
- ETHIOPIA;ETH
- NIGER;NER
- COLOMBIA;COL
- MADAGASCAR;MDG
- SENEGAL;SEN
+ DENMARK;FRO
EAST TIMOR;TLS
+ EGYPT;EGY
+ ERITREA;ERI
+ ETHIOPIA;ETH
+ FINLAND ALA;ALA
+ FINLAND;FIN
FRANCE;FRA
- RWANDA;RWA
- ZAMBIA;ZMB
+ GABON;GAB
GAMBIA THE;GMB
- DENMARK;FRO
GERMANY;DEU
- AUSTRALIA;AUS
- AUSTRIA;AUT
- NORWAY;SJM
- VENEZUELA;VEN
- KENYA;KEN
- TURKEY;TUR
+ GHANA;GHA
+ GREECE;GRC
+ GUINEA;GIN
+ GUYANA;GUY
+ INDIA;IND
+ INDONESIA;IDN
+ IRAN;IRN
+ IRAQ;IRQ
+ ISRAEL;ISR
ITALY;ITA
- BAIKONUR COSMODROME;RUS
- MEXICO;MEX
- BRAZIL;BRA
IVORY COAST;CIV
- SERBIA;SRB
- UNITED STATES OF AMERICA;USA
- UKRAINE;UKR
- CANADA;CAN
- KOREA SOUTH;KOR
- CENTRAL AFRICAN REPUBLIC;CAF
- SOMALIA;SOM
- UZBEKISTAN;UZB
- ERITREA;ERI
- POLAND;POL
- GABON;GAB
- SPAIN;ESP
- IRAQ;IRQ
- MALI;MLI
- IRAN;IRN
- SOLOMON ISLANDS;SLB
- NEW ZEALAND;NZL
JAPAN;JPN
+ KAZAKHSTAN;KAZ
+ KENYA;KEN
+ KOREA NORTH;PRK
+ KOREA SOUTH;KOR
KYRGYZSTAN;KGZ
+ LAOS;LAO
+ LIBYA;LBY
+ MADAGASCAR;MDG
+ MALAYSIA;MYS
+ MALI;MLI
+ MAURITANIA;MRT
+ MEXICO;MEX
+ MONGOLIA;MNG
+ MOROCCO;MAR
+ MOZAMBIQUE;MOZ
+ MYANMAR;MMR
+ NAMIBIA;NAM
+ NEPAL;NPL
NEW CALEDONIA;NCL
- ARGENTINA;ARG
- SUDAN;SDN
+ NEW ZEALAND;NZL
+ NIGERIA;NGA
+ NIGER;NER
+ NORWAY;SJM
+ PAKISTAN;PAK
PAPUA NEW GUINEA;PNG
- CUBA;CUB
+ PARAGUAY;PRY
+ PERU;PER
+ POLAND;POL
+ ROMANIA;ROU
+ RWANDA;RWA
+ SAUDI ARABIA;SAU
+ SENEGAL;SEN
+ SERBIA;SRB
+ SOLOMON ISLANDS;SLB
+ SOMALIA;SOM
+ SOUTH AFRICA;ZAF
+ SPAIN;ESP
+ SUDAN;SDN
+ SURINAME;SUR
+ SYRIA;SYR
+ TAJIKISTAN;TJK
+ TANZANIA;TZA
+ TOGO;TGO
+ TURKEY;TUR
+ TURKMENISTAN;TKM
+ UKRAINE;UKR
+ UNITED KINGDOM;GBR
+ UNITED KINGDOM GIB;GIB
+ UNITED STATES OF AMERICA;USA
+ URUGUAY;URY
+ UZBEKISTAN;UZB
+ VANUATU;VUT
+ VENEZUELA;VEN
+ YEMEN;YEM
+ ZAMBIA;ZMB
+ ZIMBABWE;ZWE
*
/
} = ''
diff --git a/share/metview/etc/MarsRules b/share/metview/etc/MarsRules
index 07109dd..f3193f0 100755
--- a/share/metview/etc/MarsRules
+++ b/share/metview/etc/MarsRules
@@ -474,15 +474,6 @@
%and (%not DATABASE) %then
%set DATABASE = file
-%if (_VERB = ARCHIVE %or
- _VERB = FLUSH %or
- _VERB = STAGE %or
- _VERB = LIST %or
- _VERB = REMOVE)
- %and (EXPVER=fdy1)
- %and (%not DATABASE) %then
- %set DATABASE = mars grib2
-
%if (_VERB = ARCHIVE %or
_VERB = FLUSH %or
diff --git a/share/metview/etc/ecmwf.def b/share/metview/etc/ecmwf.def
index d475d19..ef55684 100755
--- a/share/metview/etc/ecmwf.def
+++ b/share/metview/etc/ecmwf.def
@@ -745,8 +745,11 @@ TOTAL AEROSOL OPTICAL DEPTH AT 1240NM ; AOD1240 ; 216.210
SWEDEN ; SE
SWITZERLAND ; CH
TURKEY ; TR
- UNITED KINGDOM; UK
-
+ UNITED KINGDOM ; UK
+ ! 07/2016 MASV at ECMWF.INT
+ ! hack used by UERRA (tigge.def)
+ ! class on following line is fictitious
+ UNITED UERRA HACK ; UZZZ
! Test
METAPS ; MA
TEST ; TE
@@ -1542,7 +1545,7 @@ ARCHIVE ; Archives data ; MARS
@
}
- CLASS { &_DUMMY&CLASS } = OD
+ CLASS { &_DUMMY&CLASS } = OD
TYPE { &_DUMMY&TYPE } = AN
diff --git a/share/metview/etc/mars.chk b/share/metview/etc/mars.chk
index 07109dd..f3193f0 100755
--- a/share/metview/etc/mars.chk
+++ b/share/metview/etc/mars.chk
@@ -474,15 +474,6 @@
%and (%not DATABASE) %then
%set DATABASE = file
-%if (_VERB = ARCHIVE %or
- _VERB = FLUSH %or
- _VERB = STAGE %or
- _VERB = LIST %or
- _VERB = REMOVE)
- %and (EXPVER=fdy1)
- %and (%not DATABASE) %then
- %set DATABASE = mars grib2
-
%if (_VERB = ARCHIVE %or
_VERB = FLUSH %or
diff --git a/share/metview/etc/tigge.def b/share/metview/etc/tigge.def
index 53f295e..5d6c26c 100755
--- a/share/metview/etc/tigge.def
+++ b/share/metview/etc/tigge.def
@@ -112,8 +112,12 @@ TIME INTEGRATED SURFACE NET THERMAL RADIATION DOWNWARDS ; STRD ; 175
# Additions for UERRA
SPECIFIC CLOUD LIQUID WATER CONTENT ; CLWC ; 246
SPECIFIC CLOUD ICE WATER CONTENT ; CIWC ; 247
+TOTAL COLUMN INTEGRATED WATER VAPOUR ; TCIWV ; 260057
RELATIVE HUMIDITY ; R ; 157
CLOUD COVER ; CCL ; 260257
+HIGH CLOUD COVER ; HCC ; 3075
+MEDIUM CLOUD COVER ; MCC ; 3074
+LOW CLOUD COVER ; LCC ; 3073
WIND SPEED ; WS ; 10
WIND DIRECTION ; WDIR ; 3031
PRESSURE ; PRES ; 54
@@ -126,14 +130,17 @@ TIME-INTEGRATED SURFACE CLEAR-SKY SOLAR RADIATION UPWARDS ; AUSWRF_CS ; 260
TIME-INTEGRATED SURFACE DIRECT SOLAR RADIATION ; TIDIRSWRF ; 260264
TIME-INTEGRATED SURFACE CLEAR-SKY THERMAL RADIATION DOWNWARDS ; ADLWRF_CS ; 260428
10 METRE WIND DIRECTION ; 10WDIR ; 260260
+10 METRE WIND SPEED ; 10SI ; 207
WIND GUST AT 10 METRES SINCE PREVIOUS POST-PROCESSING ; 10FG ; 49
SURFACE AIR MAXIMUM TEMPERATURE SINCE PREVIOUS POST-PROCESSING ; MX2T ; 201
SURFACE AIR MINIMUM TEMPERATURE SINCE PREVIOUS POST-PROCESSING ; MN2T ; 202
LIQUID NON-FROZEN VOLUMETRIC SOIL WATER ; LIQVSM ; 260210
+VOLUMETRIC SOIL WATER ; VSW ; 260199
SOIL HEAT FLUX ; SOHF ; 260364
SOIL DEPTH ; SOD ; 260367
+SOIL TEMPERATURE ; SOT ; 260360
SNOW DEPTH ; SDE ; 3066
-
+SURFACE ROUGHNESS ; SR ; 173
*
/
} = T
@@ -161,6 +168,8 @@ SNOW DEPTH ; SDE ; 3066
ENFO
ENFH
DA ; OPER
+# For UERRA
+ ENDA
} = ENFO
EXPVER
@@ -218,6 +227,7 @@ SNOW DEPTH ; SDE ; 3066
# UERRA
ESWI
+ EDZW
/
ALL
@@ -228,16 +238,18 @@ SNOW DEPTH ; SDE ; 3066
{
GLOB
LAM
+ OFF
} = GLOB
LEVTYPE
{
POTENTIAL VORTICITY ; PV
POTENTIAL TEMPERATURE ; PT
- SURFACE ; SFC
+ SURFACE ; SL ; SFC
PRESSURE LEVELS ; PL
MODEL LEVELS ; ML
HEIGHT LEVELS ; HL
+ SOIL LEVELS ; SOL
ALL
} = PL
@@ -350,7 +362,7 @@ ARCHIVE ; Archives data ; TIGGE
@
}
- CLASS { &TIGGEDEF&CLASS } = TI
+ CLASS{ &TIGGEDEF&CLASS } = TI
TYPE { &TIGGEDEF&TYPE } = CF
diff --git a/src/Desktop/MvQFolderModel.cc b/src/Desktop/MvQFolderModel.cc
index 2ebf14c..b28a6b8 100644
--- a/src/Desktop/MvQFolderModel.cc
+++ b/src/Desktop/MvQFolderModel.cc
@@ -31,6 +31,7 @@
#include "MvQFolderItemProperty.h"
#include "MvQIconProvider.h"
#include "MvQTheme.h"
+#include "MvQFileInfo.h"
#include <assert.h>
#include <map>
@@ -769,16 +770,7 @@ QString MvQFolderModel::objectInfo( const QModelIndex & index)
QString MvQFolderModel::formatFileSize(qint64 size) const
{
- if(size < 1024)
- return QString::number(size) + " B";
- else if(size < 1024*1024)
- return QString::number(size/1024) + " KB";
- else if(size < 1024*1024*1024)
- return QString::number(size/(1024*1024)) + " MB";
- else
- return QString::number(size/(1024*1024*1024)) + " GB";
-
- return QString();
+ return MvQFileInfo::formatSize(size);
}
QString MvQFolderModel::formatFileDate(time_t t) const
@@ -974,4 +966,4 @@ bool MvQFolderFilterModel::setFilter(QString name,QString type)
return found;
}
-*/
\ No newline at end of file
+*/
diff --git a/src/Hovmoeller/HovArea.cc b/src/Hovmoeller/HovArea.cc
index 19db7b8..cd3dedb 100644
--- a/src/Hovmoeller/HovArea.cc
+++ b/src/Hovmoeller/HovArea.cc
@@ -126,7 +126,8 @@ bool HovAreaToolkit::GetInputInfo(MvRequest& in)
// Send a warning message
if ( swap )
- marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+// marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+ cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped." << endl;
// Get direction
geoDir_ = ((const char*)in("AVERAGE_DIRECTION") && strcmp(in("AVERAGE_DIRECTION"),"NORTH_SOUTH" ) == 0 ) ? HOV_NS : HOV_EW;
diff --git a/src/Hovmoeller/HovHeight.cc b/src/Hovmoeller/HovHeight.cc
index ea7f777..f03860b 100644
--- a/src/Hovmoeller/HovHeight.cc
+++ b/src/Hovmoeller/HovHeight.cc
@@ -197,7 +197,8 @@ bool HovHeightToolkit::GetInputInfo(MvRequest& in)
// Send a warning message
if ( swap )
- marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+// marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+ cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped." << endl;
// Get vertical axis type
vertAxisType_ = ( (const char*)in("VERTICAL_LEVEL_TYPE") && strcmp(in("VERTICAL_LEVEL_TYPE"),"PRESSURE") == 0 ) ? HOV_PRESSURE : HOV_ASINDATA;
diff --git a/src/Hovmoeller/HovLine.cc b/src/Hovmoeller/HovLine.cc
index 8e329b3..4a09f72 100644
--- a/src/Hovmoeller/HovLine.cc
+++ b/src/Hovmoeller/HovLine.cc
@@ -126,7 +126,8 @@ bool HovLineToolkit::GetInputInfo(MvRequest& in)
// Send a warning message
if ( swap )
- marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+// marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+ cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped." << endl;
// Get swap axes flag
swapAxes_ = ( (const char*)in("SWAP_AXES") && strcmp(in("SWAP_AXES"),"YES") == 0 ) ? true : false;
diff --git a/src/Hovmoeller/HovToolkit.cc b/src/Hovmoeller/HovToolkit.cc
index 42314f0..32ea789 100644
--- a/src/Hovmoeller/HovToolkit.cc
+++ b/src/Hovmoeller/HovToolkit.cc
@@ -437,7 +437,7 @@ bool HovToolkit::CreateParamInfo(MvRequest& data)
// Maybe this restriction should be removed in the future
if ( params_.size() > 1 )
{
- marslog(LOG_EROR, "Creation of Hovmoeller diagrams from multiple parameters is not yet supported. This data has %d parameters.", params_.size());
+ marslog(LOG_EROR, "Creation of Hovmoeller diagrams from multiple parameters or vertical levels is not yet supported. This data has %d parameters or levels.", params_.size());
return false;
}
@@ -466,9 +466,10 @@ void HovToolkit::GenerateKey(string &str, MvRequest& rq)
void HovToolkit::GenerateTimeKey(string &str, MvRequest& rq)
{
- int istep = rq("STEP");
- long idate = rq("DATE");
- int itime = rq("TIME");
+ int istep = rq("STEP");
+ int itime = rq("TIME");
+ int idate = rq.getBaseDate();
+
char key[20];
ostrstream oss( key, sizeof( key ) );
diff --git a/src/Hovmoeller/MHovmoellerDataDef b/src/Hovmoeller/MHovmoellerDataDef
index 8b13bc1..4b87bd3 100644
--- a/src/Hovmoeller/MHovmoellerDataDef
+++ b/src/Hovmoeller/MHovmoellerDataDef
@@ -56,7 +56,7 @@ AREA_HOVM; Hovmoeller AREA Application
AREA
[
help = help_input,
- help_icon = 'help_area',
+ help_icon = 'help_map',
input_type = area,
input_window = '/System/Defaults/Input Window'
]
@@ -139,7 +139,7 @@ VERTICAL_HOVM; Hovmoeller Vertical Application
AREA
[
help = help_input,
- help_icon = 'help_area',
+ help_icon = 'help_map',
input_type = area,
input_window = '/System/Defaults/Input Window'
]
diff --git a/src/Hovmoeller/MHovmoellerViewDef b/src/Hovmoeller/MHovmoellerViewDef
index babe2ae..38ed292 100644
--- a/src/Hovmoeller/MHovmoellerViewDef
+++ b/src/Hovmoeller/MHovmoellerViewDef
@@ -20,7 +20,7 @@ MHOVMOELLERVIEW; uPlot Icon; Metview
AREA [
help = help_input,
- help_icon = 'help_area',
+ help_icon = 'help_map',
input_type = area,
input_window = '/System/Defaults/Input Window'
]
diff --git a/src/Macro/bufr.cc b/src/Macro/bufr.cc
index 2638a57..c2ab69b 100644
--- a/src/Macro/bufr.cc
+++ b/src/Macro/bufr.cc
@@ -1179,6 +1179,11 @@ Value SubGeoFunction::Execute(int,Value *arg)
p->load();
request *r = empty_request(NULL);
+
+ if (n < 0 || n > p->Count()-1)
+ return Error("Geopoints index is %ld, but should be from 0 to %ld", n, p->Count()-1);
+
+
MvGeoP1& g = (*p)[n];
set_value(r,"latitude", "%g", g.lat_y() );
diff --git a/src/Macro/grib.cc b/src/Macro/grib.cc
index 5b00308..4f74bb9 100644
--- a/src/Macro/grib.cc
+++ b/src/Macro/grib.cc
@@ -7,15 +7,18 @@
***************************** LICENSE END *************************************/
-#include "macro.h"
#include <math.h>
#include <ctype.h>
#include <assert.h>
-#include "MvGrid.h"
+
+#include "macro.h"
#include "cbufr.h"
#include "inc_stl.h"
+#include "script.h"
+
#include "MvException.h"
#include "MvFieldSet.h"
+#include "MvGrid.h"
#include "MvPath.hpp"
#define NO_MVGRID 0
@@ -5384,6 +5387,7 @@ double CovarFunc( field* f1, field* f2, const MvGeoBox& area )
CGrib::CGrib(fieldset *v) : InPool(tgrib), cube(0)
{
+ path_ = "";
static int done = 0;
if(!done)
@@ -5398,36 +5402,36 @@ CGrib::CGrib(fieldset *v) : InPool(tgrib), cube(0)
CGrib::CGrib(request *r) : InPool(tgrib,r), cube(0)
{
- fs = request_to_fieldset(r);
-
- // Make sure all path are temporary
- while(r)
- {
- if(get_value(r,"PATH",0))
- {
- const char *p = get_value(r,"TEMPORARY",0);
- if(!p) return;
- if(atoi(p) == 0) return;
- }
- r = r->next;
- }
+ fs = request_to_fieldset(r);
+ path_ = MakeAbsolutePath((const char*)get_value(r,"PATH",0),dirname(Script::MacroMainPath()));
- // We will handle the unlinking of temp file ourselves
- if(!IsIcon())
- {
- IsIcon(true); // InPool won't touch the data
- SetFileTempFlag(true);
- }
+ // Make sure all path are temporary
+ while(r)
+ {
+ if(get_value(r,"PATH",0))
+ {
+ const char *p = get_value(r,"TEMPORARY",0);
+ if(!p) return;
+ if(atoi(p) == 0)
+ return;
+ }
+ r = r->next;
+ }
+ // We will handle the unlinking of temp file ourselves
+ if(!IsIcon())
+ {
+ IsIcon(true); // InPool won't touch the data
+ SetFileTempFlag(true);
+ }
}
CGrib::CGrib(const char *fname) : InPool(tgrib), cube(0)
{
- //fs = read_fieldset(fname,0);
- fs = read_fieldset(FullPathName(fname).c_str(),0);
+ path_ = "";
+ fs = read_fieldset(FullPathName(fname).c_str(),0);
}
-
void CGrib::DestroyContent()
{
// Check if we have more that one ref
@@ -5462,8 +5466,7 @@ void CGrib::ToRequest(request* &s)
set_value(r,"_CLASS","MACRO");
set_value(r,"_NAME","%s",GetName());
-
-
+ set_value(r,"_PATH",path_.c_str());
// fieldset_to_request() sets the 'temp' member of the gribfile for each
// field to 'false', meaning that even if this is supposed to be a temporary
diff --git a/src/Macro/include/value.h b/src/Macro/include/value.h
index 3bfb896..b50600e 100644
--- a/src/Macro/include/value.h
+++ b/src/Macro/include/value.h
@@ -26,11 +26,17 @@ typedef int _vtype;
class Value;
+using std::string;
+
//=============================================================================
class Notify {
+
public:
- virtual void trigger(void*) = 0;
+ Notify() {}
+ ~Notify() {}
+
+ virtual void trigger(void*) = 0;
};
class Reference {
@@ -245,26 +251,39 @@ public:
//=============================================================================
class CGrib : public InPool {
- fieldset *fs;
- hypercube *cube;
- virtual void ToFieldset(fieldset* &x) { x = fs; };
- virtual void ToRequest(request* &);
- virtual void ToGrib(CGrib* &x) { x = this;};
- virtual void Print(void);
- virtual int Write(FILE*);
- virtual Content *Clone(void);
- virtual void SetSubValue(Value&,int,Value*);
- virtual void Dump2();
- void DestroyContent();
+
+ fieldset *fs;
+ hypercube *cube;
+ string path_; // It stores an absolute path. This is important
+ // specially if request parameter PATH contains
+ // a relative path.
+
+ virtual void ToFieldset(fieldset* &x)
+ { x = fs; }
+
+ virtual void ToRequest(request* &);
+ virtual void ToGrib(CGrib* &x)
+ { x = this; }
+
+ virtual void Print(void);
+ virtual int Write(FILE*);
+ virtual Content *Clone(void);
+ virtual void SetSubValue(Value&,int,Value*);
+ virtual void Dump2();
+ void DestroyContent();
public:
- CGrib(const char *);
- CGrib(request *);
- CGrib(fieldset *);
- fieldset *GetFieldset(void) { return fs; };
- void SetFileTempFlag(boolean);
- ~CGrib();
- hypercube* get_cube();
+ CGrib(const char*);
+ CGrib(request*);
+ CGrib(fieldset*);
+
+ ~CGrib();
+
+ fieldset *GetFieldset(void)
+ { return fs; };
+
+ void SetFileTempFlag(boolean);
+ hypercube* get_cube();
};
diff --git a/src/Macro/main.cc b/src/Macro/main.cc
index 92d3b1e..95f9586 100644
--- a/src/Macro/main.cc
+++ b/src/Macro/main.cc
@@ -12,6 +12,7 @@
#include <cctype>
#include "script.h"
#include "MvDebugPrintControl.h"
+#include "MvPath.hpp"
typedef struct data {
boolean serve;
@@ -73,7 +74,7 @@ class sbuf : public streambuf { // 76830942
virtual int overflow(int c=EOF)
{
- if(n >= sizeof(line)-2) sync();
+ if(n >= (signed)sizeof(line)-2) sync();
if( (line[n++] = c) == '\n' ) { n--; sync(); }
return 0;
}
@@ -181,18 +182,16 @@ static void serve_macro(svcid *id,request *r,void *data)
Script::SvcId = id;
mars.outproc = Script::PutMessage;
- char save[1024];
- getcwd(save,sizeof(save)-1);
-
-
-// chdir(getenv("METVIEW_USER_DIRECTORY"));
-// chdir(dirname(name)+1);
-
- chdir(dirname(path)); // to ensure we always get the dir that the
- // macro is in, even if run from the editor
- setenv("PWD",dirname(path),1); // change env variable too
-
-
+ // Important: first, save directory where the Macro application is
+ // currently running, usually where the Macro executable is located.
+ // Second, change directory to where the Macro program is located.
+ // Third, before finishing the execution of this program, restore
+ // the current directory.
+ char save[1024];
+ getcwd(save,sizeof(save)-1);
+ chdir(dirname(path)); // to ensure we always get the dir that the
+ // macro is in, even if run from the editor
+ setenv("PWD",dirname(path),1); // change env variable too
start_timer();
@@ -213,15 +212,12 @@ static void serve_macro(svcid *id,request *r,void *data)
{
Value v(param);
-
- // Because the macro editor uses a temp file,
- // we need to set the MacroPath here again
- char buf[1024];
- sprintf(buf,"%s/%s",getenv("METVIEW_USER_DIRECTORY"),name);
- Script::MacroPath(buf); //It can be updated according to the
- // last function compiled
- Script::MacroMainPath(buf);
+ // Because the macro editor uses a temp file,
+ // we need to set the MacroPath here again
+ string fullPath = MakeAbsolutePath(name);
+ Script::MacroPath(fullPath.c_str());
+ Script::MacroMainPath(fullPath.c_str());
s->SetRunMode(action);
Context::Trace(trace?atoi(trace):0);
@@ -300,10 +296,19 @@ static void serve_macro(svcid *id,request *r,void *data)
marslog(LOG_INFO,"Compile+run = %s",info);
marslog(LOG_INFO,"End of %s %s %s",path,name,action);
+ // Add parameter _PATH
+ if ( !(const char*)get_value(reply,"_PATH",0) )
+ {
+ string fullPath = MakeAbsolutePath((const char*)get_value(reply,"PATH",0),dirname(Script::MacroMainPath()));
+ set_value(reply,"_PATH",fullPath.c_str());
+ }
+
send_reply(id,reply);
// Don't free reply, it's go when the Value is destroyed
- chdir(save);
+ // Restore current directory
+ chdir(save);
+
if(forked != -1)
{
destroy_service(id->s);
@@ -474,8 +479,6 @@ static void serve_formula(svcid *id,request *r,void*)
int main(int argc,char **argv)
{
- extern int zzdebug;
-
marsinit(&argc,argv,&setup,NUMBER(opts),opts);
mvSetMarslogLevel(); //-- if "quiet log"
diff --git a/src/Macro/request.cc b/src/Macro/request.cc
index da31e34..fa8e428 100644
--- a/src/Macro/request.cc
+++ b/src/Macro/request.cc
@@ -13,6 +13,8 @@
#include "macro.h"
#include "script.h"
#include "value.h"
+
+#include "MvPath.hpp"
#include "MvRequest.h"
#include "MvApplication.h"
@@ -611,8 +613,10 @@ Value SimpleRequestFunction::Execute(int arity ,Value *arg)
set_subrequest(r,"_DEVICE_DRIVER",s); //-- directrly for new PlotMod
}
#endif
- set_value(r,"_MACRO","%s",Script::MacroPath());
- set_value(r,"_PATH","%s",Script::MacroMainPath());
+
+ set_value(r,"_MACRO","%s",Script::MacroPath());
+ string fullPath = MakeAbsolutePath((const char*)get_value(r,"PATH",0),dirname(Script::MacroMainPath()));
+ set_value(r,"_PATH",fullPath.c_str());
}
v = service ? Value(service,r,attachedContent) : Value(r);
@@ -1007,7 +1011,8 @@ Value ComplexRequestFunction::Execute(int arity ,Value *arg)
}
set_value(p,"_MACRO","%s",Script::MacroPath());
- set_value(p,"_PATH","%s",Script::MacroMainPath());
+ string fullPath = MakeAbsolutePath((const char*)get_value(p,"PATH",0),dirname(Script::MacroMainPath()));
+ set_value(p,"_PATH",fullPath.c_str());
Value v(Service(),p);
free_all_requests(p);
@@ -1104,9 +1109,11 @@ Value PlotFunction::ExecuteComplexRequestFunction(int arity ,Value *arg)
}
}
- set_value(p,"_MACRO","%s",Script::MacroPath());
- set_value(p,"_PATH","%s",Script::MacroMainPath());
- set_value(p,"_NAME",Context::UniqueName());
+ // Add hidden parameters
+ set_value(p,"_MACRO","%s",Script::MacroPath());
+ set_value(p,"_NAME",Context::UniqueName());
+ string fullPath = MakeAbsolutePath((const char*)get_value(p,"PATH",0),dirname(Script::MacroMainPath()));
+ set_value(p,"_PATH",fullPath.c_str());
// Define output requests according to the following rules/priorities:
// 1. Drivers defined in the "plot" command have top priority (overwrite "setoutput")
diff --git a/src/Macro/value.cc b/src/Macro/value.cc
index c719ffe..110122d 100644
--- a/src/Macro/value.cc
+++ b/src/Macro/value.cc
@@ -49,7 +49,7 @@ class SimpleNotify : public Notify {
virtual void trigger(void*);
public:
SimpleNotify(const char*,const char*);
- ~SimpleNotify();
+ virtual ~SimpleNotify();
};
SimpleNotify::SimpleNotify(const char *m,const char *n)
diff --git a/src/XSection/MVProfileViewDef b/src/XSection/MVProfileViewDef
index 5022afc..ed92660 100644
--- a/src/XSection/MVProfileViewDef
+++ b/src/XSection/MVProfileViewDef
@@ -21,7 +21,7 @@ MVPROFILEVIEW; PlotMod Icon; Metview
AREA [
help = help_input,
- help_icon = 'help_area',
+ help_icon = 'help_map',
input_type = area,
input_window = '/System/Defaults/Input Window'
]
diff --git a/src/XSection/MXAverageDef b/src/XSection/MXAverageDef
index ed36280..f22b944 100644
--- a/src/XSection/MXAverageDef
+++ b/src/XSection/MXAverageDef
@@ -25,7 +25,7 @@ MXAVERAGE; Metview; Specific Application
AREA [
help = help_input,
- help_icon = 'help_area',
+ help_icon = 'help_map',
input_type = area,
input_window = '/System/Defaults/Input Window'
]
diff --git a/src/XSection/MXAverageViewDef b/src/XSection/MXAverageViewDef
index 05bf0da..c148fae 100644
--- a/src/XSection/MXAverageViewDef
+++ b/src/XSection/MXAverageViewDef
@@ -24,7 +24,7 @@ MXAVERAGEVIEW; uPlot Icon; Metview
AREA [
help = help_input,
- help_icon = 'help_area',
+ help_icon = 'help_map',
input_type = area,
input_window = '/System/Defaults/Input Window'
]
@@ -39,10 +39,10 @@ MXAVERAGEVIEW; uPlot Icon; Metview
EAST WEST ; EW
} = NS
- MAP_PROJECTION [ visible = false ]
- {
- cartesian
- } = cartesian
+# MAP_PROJECTION [ visible = false ]
+# {
+# cartesian
+# } = cartesian
HORIZONTAL_AXIS [
interface = icon,
diff --git a/src/XSection/MXSectionViewDef b/src/XSection/MXSectionViewDef
index 0e6cb76..713ef08 100644
--- a/src/XSection/MXSectionViewDef
+++ b/src/XSection/MXSectionViewDef
@@ -12,10 +12,10 @@ MXSECTIONVIEW; uPlot Icon; Metview
%include MXSectionCommonDef
- MAP_PROJECTION [ visible = false ]
- {
- cartesian
- } = cartesian
+# MAP_PROJECTION [ visible = false ]
+# {
+# cartesian
+# } = cartesian
HORIZONTAL_AXIS [interface = icon,
class = MAXIS,
diff --git a/src/XSection/Xsect.cc b/src/XSection/Xsect.cc
index 9c4f2f9..399f369 100644
--- a/src/XSection/Xsect.cc
+++ b/src/XSection/Xsect.cc
@@ -120,7 +120,7 @@ bool Xsect::processData( MvRequest& data, ApplicationInfo& appInfo, MvRequest& o
iparam = rq("PARAM");
const char *lev = rq("LEVELIST");
istep = rq("STEP");
- idate = rq("DATE");
+ idate = rq.getBaseDate();
itime = rq("TIME");
expver = rq("EXPVER");
isML = field.isModelLevel();
@@ -279,7 +279,7 @@ bool Xsect::processData( MvRequest& data, ApplicationInfo& appInfo, MvRequest& o
currentGenerated++;
MvRequest r = field.getRequest();
iparam = r("PARAM");
- idate = r("DATE");
+ idate = r.getBaseDate();
itime = r("TIME");
istep = r("STEP");
expver = r("EXPVER");
diff --git a/src/libMetview/MvFieldSet.cc b/src/libMetview/MvFieldSet.cc
index 8285da6..fcb79f5 100644
--- a/src/libMetview/MvFieldSet.cc
+++ b/src/libMetview/MvFieldSet.cc
@@ -1688,7 +1688,7 @@ double MvField::yyyymmddFoh()
return 0; //-- failed to extract date
#endif
- double dat = mvgrid_->getDouble("date");
+ double dat = mvgrid_->getDouble("dataDate");
double tim = mvgrid_->getDouble("time");
//nontested_grib_api_port("MvField::yyyymmddFoh()");
diff --git a/src/libMetview/MvRequest.cc b/src/libMetview/MvRequest.cc
index f73568d..68dc83f 100644
--- a/src/libMetview/MvRequest.cc
+++ b/src/libMetview/MvRequest.cc
@@ -1010,8 +1010,23 @@ bool MvRequest::getPath(const char* iconPar,const char* textPar,string &resPath,
return true;
}
-
-
+
+
+
+// MvRequest::getBaseDate()
+// returns zero if neither HDATE nor DATE are present in the request
+int MvRequest::getBaseDate()
+{
+ int date = (*this)("HDATE"); // try HDATE first (will return 0 if not there)
+
+ if (date == 0)
+ date = (*this)("DATE"); // no HDATE? try DATE (will return 0 if not there)
+
+ return date;
+}
+
+
+
bool MvRequest::getValueId(const char* par,string& value,const std::map<string,string>& idMap,bool canBeEmpty,string &errTxt)
{
value.clear();
diff --git a/src/libMetview/MvRequest.h b/src/libMetview/MvRequest.h
index 6278d94..5e59ba1 100644
--- a/src/libMetview/MvRequest.h
+++ b/src/libMetview/MvRequest.h
@@ -584,6 +584,9 @@ public:
MvRequest ExpandRequest ( const char*, const char*, long );
+ // Get the base date from the request (specific to request from GRIB data)
+ int getBaseDate();
+
//Find out path (it can be relative path as well) stored in parameter par.
bool getPath(const char* par,string& resPath,bool canBeEmpty,string &errTxt);
bool getPath(const char* iconPar,const char* textPar,string &resPath,bool canBeEmpty,string &errTxt);
diff --git a/src/libMetview/MvScanFileType.cc b/src/libMetview/MvScanFileType.cc
index 845c0f9..1743956 100644
--- a/src/libMetview/MvScanFileType.cc
+++ b/src/libMetview/MvScanFileType.cc
@@ -198,6 +198,9 @@ static const char *scan_file(const char *file)
if (scan_file_extension (file, length, ".magml")) return "MAGML";
if (scan_file_extension (file, length, ".html")) return "HTML";
if (scan_file_extension (file, length, ".zip")) return "ZIP";
+ if (scan_file_extension (file, length, ".pdf")) return "PDF";
+ if (scan_file_extension (file, length, ".png")) return "PNG";
+ if (scan_file_extension (file, length, ".ps")) return "PSFILE";
if (scan_file_extension (file, length, ".gif")) return "GIF";
if (scan_file_extension (file, length, ".tiff")) return "TIFF";
if (scan_file_extension (file, length, ".tif")) return "TIFF";
diff --git a/src/libMvQtGui/MvQAbstractMessageExaminer.cc b/src/libMvQtGui/MvQAbstractMessageExaminer.cc
index 4343e57..e9fe108 100644
--- a/src/libMvQtGui/MvQAbstractMessageExaminer.cc
+++ b/src/libMvQtGui/MvQAbstractMessageExaminer.cc
@@ -39,7 +39,6 @@
#include "MvQAbstractMessageExaminer.h"
-#include "MvFileInfo.h"
#include "MvKeyProfile.h"
#include "MvVersionInfo.h"
#include "LogHandler.h"
diff --git a/src/libMvQtGui/MvQFileInfoLabel.cc b/src/libMvQtGui/MvQFileInfoLabel.cc
index 4e2251e..7a968bb 100644
--- a/src/libMvQtGui/MvQFileInfoLabel.cc
+++ b/src/libMvQtGui/MvQFileInfoLabel.cc
@@ -8,27 +8,27 @@
***************************** LICENSE END *************************************/
#include "MvQFileInfoLabel.h"
-#include "MvFileInfo.h"
+#include "MvQFileInfo.h"
MvQFileInfoLabel::MvQFileInfoLabel(QWidget* parent) : QLabel(parent)
{
- setObjectName(QString::fromUtf8("fileInfoLabel"));
+ setObjectName(QString::fromUtf8("fileInfoLabel"));
//Set size policy
- QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+ QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
setSizePolicy(sizePolicy);
//setMinimumSize(QSize(0, 60));
//setMaximumSize(QSize(16777215, 45));
-
- setMargin(8);
- setAlignment(Qt::AlignLeft| Qt::AlignVCenter);
- //Other settings
+ setMargin(8);
+ setAlignment(Qt::AlignLeft| Qt::AlignVCenter);
+
+ //Other settings
setAutoFillBackground(true);
- //setFrameShape(QFrame::Box);
+ //setFrameShape(QFrame::Box);
//setFrameShape(QFrame::StyledPanel);
setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
@@ -37,138 +37,138 @@ MvQFileInfoLabel::MvQFileInfoLabel(QWidget* parent) : QLabel(parent)
QString MvQFileInfoLabel::buildTextLabel(QString fileName)
{
- QString s;
- MvFileInfo info(fileName.toStdString());
-
- s="<b><font color=#000000>File: </font></b>";
- s+="<font color=000010>" + QString(info.name().c_str()) + "</font>";
- s+="<br>";
-
- if(info.permissions().find("l") != string::npos)
- {
- s+="<b><font color=#000000>Symlink target: </font></b>";
- s+="<font color=000010>" +QString(info.linkTo().c_str()) + "</font>";
- s+="<br>";
-
- //Make the label bigger
- //setMinimumSize(QSize(0, 70));
- }
-
- s+="<b><font color=#000000>Permissions: </font></b>";
- s+="<font color=000010>" + QString(info.permissions().c_str()) + "</font>";
- s+="<b><font color=#000000> Owner: </font></b>";
- s+="<font color=000010>" + QString(info.owner().c_str()) + "</font>";
- s+="<b><font color=#000000> Group:</font> </b>";
- s+="<font color=000010>" + QString(info.group().c_str()) + "</font>";
- //s+="<b> Size: </b> <font color=#ff0000>";
- s+="<b><font color=#000000> Size: </font></b>";
- s+="<font color=000010>" + QString(info.size().c_str()) + "</font>";
- s+="<font color=#000000><b> Modified:</font> </b>";
- s+="<font color=000010>" + QString(info.modified().c_str()) + "</font>";
-
- return s;
+ QString s;
+ MvQFileInfo info(fileName);
+
+ s="<b><font color=#000000>File: </font></b>";
+ s+="<font color=000010>" + info.absoluteFilePath() + "</font>";
+ s+="<br>";
+
+ if(info.isSymLink())
+ {
+ s+="<b><font color=#000000>Symlink target: </font></b>";
+ s+="<font color=000010>" +info.symLinkTarget() + "</font>";
+ s+="<br>";
+
+ //Make the label bigger
+ //setMinimumSize(QSize(0, 70));
+ }
+
+ s+="<b><font color=#000000>Permissions: </font></b>";
+ s+="<font color=000010>" + info.formatPermissions() + "</font>";
+ s+="<b><font color=#000000> Owner: </font></b>";
+ s+="<font color=000010>" + info.owner() + "</font>";
+ s+="<b><font color=#000000> Group:</font> </b>";
+ s+="<font color=000010>" + info.group() + "</font>";
+ //s+="<b> Size: </b> <font color=#ff0000>";
+ s+="<b><font color=#000000> Size: </font></b>";
+ s+="<font color=000010>" + info.formatSize() + "</font>";
+ s+="<font color=#000000><b> Modified:</font> </b>";
+ s+="<font color=000010>" + info.formatModDate() + "</font>";
+
+ return s;
}
void MvQFileInfoLabel::setTextLabel(QString fileName)
{
- QString s=buildTextLabel(fileName);
- setText(s);
-}
+ QString s=buildTextLabel(fileName);
+ setText(s);
+}
void MvQFileInfoLabel::setGribTextLabel(QString fileName,int messageNum,bool filtered,int filteredMessageNum,bool hasMultiMessage)
{
- QString s=buildTextLabel(fileName);
- s+="<br>";
-
- if(filtered)
- {
- s+="<b><font color=#000000>Number of filtered messages: </font></b>";
- s+="<font color=000010>" + QString::number(filteredMessageNum);
- s+=" (out of " + QString::number(messageNum) + ")</font>";
- }
- else
- {
- s+="<b><font color=#000000>Total number of messages: </font></b>";
- s+="<font color=000010>" + QString::number(messageNum) + "</font>";
- if(hasMultiMessage)
- {
- s+="<font color=#f4a119> (some messages contain multiple fields!) </font>";
- }
-
- }
- setText(s);
-}
+ QString s=buildTextLabel(fileName);
+ s+="<br>";
+
+ if(filtered)
+ {
+ s+="<b><font color=#000000>Number of filtered messages: </font></b>";
+ s+="<font color=000010>" + QString::number(filteredMessageNum);
+ s+=" (out of " + QString::number(messageNum) + ")</font>";
+ }
+ else
+ {
+ s+="<b><font color=#000000>Total number of messages: </font></b>";
+ s+="<font color=000010>" + QString::number(messageNum) + "</font>";
+ if(hasMultiMessage)
+ {
+ s+="<font color=#f4a119> (some messages contain multiple fields!) </font>";
+ }
+
+ }
+ setText(s);
+}
void MvQFileInfoLabel::setBufrTextLabel(QString fileName,int messageNum)
{
- QString s=buildTextLabel(fileName);
- s+="<br>";
- s+="<b><font color=#000000>Total number of messages: </font></b>";
- s+="<font color=000010>" + QString::number(messageNum) + "</font>";
-
- setText(s);
-}
+ QString s=buildTextLabel(fileName);
+ s+="<br>";
+ s+="<b><font color=#000000>Total number of messages: </font></b>";
+ s+="<font color=000010>" + QString::number(messageNum) + "</font>";
+
+ setText(s);
+}
void MvQFileInfoLabel::setObstatScatterTextLabel(QString fileName,int itemNum)
{
- QString s=buildTextLabel(fileName);
- s+="<br>";
- s+="<b><font color=#000000>Total number of items: </font></b>";
- s+="<font color=000010>" + QString::number(itemNum) + "</font>";
+ QString s=buildTextLabel(fileName);
+ s+="<br>";
+ s+="<b><font color=#000000>Total number of items: </font></b>";
+ s+="<font color=000010>" + QString::number(itemNum) + "</font>";
- setText(s);
+ setText(s);
}
void MvQFileInfoLabel::setOdbTextLabel(QString fileName,QString)
{
- QString s=buildTextLabel(fileName);
- //s+="<br>";
- //s+="<b>Version: </b>";
- //s+=version;
+ QString s=buildTextLabel(fileName);
+ //s+="<br>";
+ //s+="<b>Version: </b>";
+ //s+=version;
- setText(s);
+ setText(s);
}
void MvQFileInfoLabel::setGeopTextLabel(QString fileName, QString format, long itemNum)
{
- QString s=buildTextLabel(fileName);
- s+="<br>";
+ QString s=buildTextLabel(fileName);
+ s+="<br>";
- s+="<b><font color=#000000>Format: </font></b>";
- s+="<font color=000010>" + format + "</font>";
- s+="<br>";
+ s+="<b><font color=#000000>Format: </font></b>";
+ s+="<font color=000010>" + format + "</font>";
+ s+="<br>";
- s+="<b><font color=#000000>Total number of points: </font></b>";
- s+="<font color=000010>" + QString::number(itemNum) + "</font>";
+ s+="<b><font color=#000000>Total number of points: </font></b>";
+ s+="<font color=000010>" + QString::number(itemNum) + "</font>";
- setText(s);
+ setText(s);
}
void MvQFileInfoLabel::setFlextraTextLabel(QString fileName, QString iconName, int itemNum)
{
- QString s;
- s="<b><font color=#000000>Icon: </font></b>";
- s+="<font color=000010>" + iconName + "</font>";
- s+="<br>";
- s+=buildTextLabel(fileName);
- s+="<br>";
- s+="<b><font color=#000000>Total number of groups: </font></b>";
- s+="<font color=000010>" + QString::number(itemNum) + "</font>";
-
- setText(s);
+ QString s;
+ s="<b><font color=#000000>Icon: </font></b>";
+ s+="<font color=000010>" + iconName + "</font>";
+ s+="<br>";
+ s+=buildTextLabel(fileName);
+ s+="<br>";
+ s+="<b><font color=#000000>Total number of groups: </font></b>";
+ s+="<font color=000010>" + QString::number(itemNum) + "</font>";
+
+ setText(s);
}
void MvQFileInfoLabel::setProfileTextLabel(QString fileName,int stepNum, int levNum,QString id)
{
- QString s=buildTextLabel(fileName);
- s+="<br>";
- s+="<b><font color=#000000>Steps: </font></b>";
- s+="<font color=000010>" + QString::number(stepNum) + "</font>";
- s+="<b><font color=#000000> Model levels: </font></b>";
- s+="<font color=000010>" + QString::number(levNum) + "</font>";
- s+="<br>";
- s+="<b><font color=#000000>Data type: </font></b>";
- s+="<font color=000010>" + id + "</font>";
-
- setText(s);
-}
+ QString s=buildTextLabel(fileName);
+ s+="<br>";
+ s+="<b><font color=#000000>Steps: </font></b>";
+ s+="<font color=000010>" + QString::number(stepNum) + "</font>";
+ s+="<b><font color=#000000> Model levels: </font></b>";
+ s+="<font color=000010>" + QString::number(levNum) + "</font>";
+ s+="<br>";
+ s+="<b><font color=#000000>Data type: </font></b>";
+ s+="<font color=000010>" + id + "</font>";
+
+ setText(s);
+}
diff --git a/src/libMvQtUtil/CMakeLists.txt b/src/libMvQtUtil/CMakeLists.txt
index c8ce044..654df1b 100644
--- a/src/libMvQtUtil/CMakeLists.txt
+++ b/src/libMvQtUtil/CMakeLists.txt
@@ -9,6 +9,7 @@ endif()
set(libMvQtUtil_srcs
+ MvQFileInfo.cc
MvQKeyManager.cc
MvQNetworkAccessManager.cc
MvQNetworkProxyFactory.cc
diff --git a/src/libMvQtUtil/MvQFileInfo.cc b/src/libMvQtUtil/MvQFileInfo.cc
new file mode 100644
index 0000000..888ffd6
--- /dev/null
+++ b/src/libMvQtUtil/MvQFileInfo.cc
@@ -0,0 +1,61 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#include "MvQFileInfo.h"
+
+#include <QDateTime>
+
+QString MvQFileInfo::formatSize() const
+{
+ return formatSize(size());
+}
+
+QString MvQFileInfo::formatModDate() const
+{
+ QDateTime dt=lastModified();
+ return dt.toString("yyyy-MM-dd hh:mm:ss");
+}
+
+QString MvQFileInfo::formatPermissions() const
+{
+ QString str(permission(QFile::ReadOwner)?"r":"-");
+ str+=(permission(QFile::WriteOwner)?"w":"-");
+ str+=(permission(QFile::ExeOwner)?"x":"-");
+ str+=(permission(QFile::ReadGroup)?"r":"-");
+ str+=(permission(QFile::WriteGroup)?"w":"-");
+ str+=(permission(QFile::ExeGroup)?"x":"-");
+ str+=(permission(QFile::ReadOther)?"r":"-");
+ str+=(permission(QFile::WriteOther)?"w":"-");
+ str+=(permission(QFile::ExeOther)?"x":"-");
+
+ return str;
+}
+
+QString MvQFileInfo::formatSize(qint64 size)
+{
+ if(size < 1024)
+ return QString::number(size) + " B";
+ else if(size < 1024*1024)
+ return handleSizePrecision(((double)size)/1024, "KB");
+ else if(size < 1024*1024*1024)
+ return handleSizePrecision(((double)size)/(1024*1024), "MB");
+ else
+ return handleSizePrecision(((double)size)/(1024*1024*1024), "GB");
+
+ return QString();
+}
+
+QString MvQFileInfo::handleSizePrecision(double sizeInUnits, QString unitsString)
+{
+ // if less than 10, use one decimal place, otherwise round to the nearest int
+ if (sizeInUnits < 10)
+ return QString::number(sizeInUnits, 'f', 1) + " " + unitsString;
+ else
+ return QString::number((unsigned int)(sizeInUnits + 0.5)) + " " + unitsString;
+}
diff --git a/src/libMvQtUtil/MvQFileInfo.h b/src/libMvQtUtil/MvQFileInfo.h
new file mode 100644
index 0000000..a13b284
--- /dev/null
+++ b/src/libMvQtUtil/MvQFileInfo.h
@@ -0,0 +1,33 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#ifndef MVQFILEINFO_H
+#define MVQFILEINFO_H
+
+#include <string>
+#include <QFileInfo>
+
+class MvQFileInfo : public QFileInfo
+{
+public:
+ MvQFileInfo(const std::string& path) : QFileInfo(QString::fromStdString(path)) {}
+ MvQFileInfo(QString path) : QFileInfo(path) {}
+
+ QString formatSize() const;
+ QString formatModDate() const;
+ QString formatPermissions() const;
+
+ static QString formatSize(qint64);
+
+private:
+ static QString handleSizePrecision(double sizeInUnits, QString unitsString);
+};
+
+#endif // MVQFILEINFO_H
+
diff --git a/src/libUtil/CMakeLists.txt b/src/libUtil/CMakeLists.txt
index 16a4940..252a242 100644
--- a/src/libUtil/CMakeLists.txt
+++ b/src/libUtil/CMakeLists.txt
@@ -9,7 +9,6 @@ MtInputEvent.cc
MvAlmostObsoleteRequest.cc
MvElement.cc
MvException.cc
-MvFileInfo.cc
MvFlextra.cc
MvKeyProfile.cc
MvKeyManager.cc
@@ -30,7 +29,7 @@ TableReader.cc
Tokenizer.cc
UtilitiesC.c
Cached.h GribMetaData.h LogHandler.h MagicsColours.h MtInputEvent.h MvException.h
-MvFileInfo.h MvFlextra.h MvGribParC.h MvKeyManager.h MvKeyProfile.h MvMessageMetaData.h MvMsg.h MvOdb.h
+MvFlextra.h MvGribParC.h MvKeyManager.h MvKeyProfile.h MvMessageMetaData.h MvMsg.h MvOdb.h
MvSTL.h MvStopWatch.h MvVersionInfo.h Rectangle.h Request.h UtilitiesC.h auto_ptr.h
bits.h gdefines.h inc_iostream.h inc_stl.h min_max_macros.h
xec.h
diff --git a/src/libUtil/MvFileInfo.cc b/src/libUtil/MvFileInfo.cc
deleted file mode 100644
index 619258c..0000000
--- a/src/libUtil/MvFileInfo.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/***************************** LICENSE START ***********************************
-
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
- of the Apache License version 2.0. In applying this license, ECMWF does not
- waive the privileges and immunities granted to it by virtue of its status as
- an Intergovernmental Organization or submit itself to any jurisdiction.
-
- ***************************** LICENSE END *************************************/
-
-#include <sstream>
-#include <vector>
-#include <stdio.h>
-
-#include "MvFileInfo.h"
-
-MvFileInfo::MvFileInfo(string name)
-{
- name_=name;
-
- string buf="ls -lhd \"" + name_ + "\"";
-
- FILE *in;
- char cbuf[512];
-
- if (!(in = popen(buf.c_str(),"r")) )
- {
- return;
- }
-
- if(fgets(cbuf, sizeof(cbuf), in) == NULL)
- {
- pclose(in);
- return;
- }
-
- pclose(in);
-
- stringstream ss(cbuf);
- vector<string> tokens;
-
- while (ss >> buf)
- {
- tokens.push_back(buf);
- }
-
- if(tokens.size() < 7)
- {
- return;
- }
-
- permissions_=tokens[0];
- owner_=tokens[2];
- group_=tokens[3];
- //size_=tokens[4];
- size_=sizeInBytes(name_);
- if(size_ != "???")
- {
- size_.append("B");
- }
-
- modified_=tokens[5] + " " +tokens[6] ;
-
- if(permissions_.find("l") != string::npos)
- {
- size_="???";
- string sbuf(cbuf);
- string::size_type pos;
- if((pos=sbuf.find("->")) != string::npos)
- {
- linkTo_=sbuf.substr(pos+3);
- if((pos=linkTo_.find('\n')) != string::npos)
- {
- linkTo_.erase(pos,1);
- }
-
- size_=sizeInBytes(linkTo_);
- if(size_ != "???")
- {
- size_.append("B");
- }
- }
- }
-}
-
-string MvFileInfo::sizeInBytes(string path)
-{
- string buf="du -sh \"" + path + "\"";
-
- FILE *in;
- char cbuf[512];
-
- if (!(in = popen(buf.c_str(),"r")) )
- {
- return string("???");
- }
-
- if(fgets(cbuf, sizeof(cbuf), in) == NULL)
- {
- pclose(in);
- return string("???");
- }
-
- pclose(in);
-
- stringstream ss(cbuf);
-
- while(ss >> buf)
- {
- return buf;
- }
-
- return string("???");
-}
\ No newline at end of file
diff --git a/src/libUtil/MvFileInfo.h b/src/libUtil/MvFileInfo.h
deleted file mode 100644
index 2d7b048..0000000
--- a/src/libUtil/MvFileInfo.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************** LICENSE START ***********************************
-
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
- of the Apache License version 2.0. In applying this license, ECMWF does not
- waive the privileges and immunities granted to it by virtue of its status as
- an Intergovernmental Organization or submit itself to any jurisdiction.
-
- ***************************** LICENSE END *************************************/
-
-#ifndef MvFileInfo_H
-#define MvFileInfo_H
-
-#include <iostream>
-
-using namespace std;
-
-class MvFileInfo
-{
-public:
- MvFileInfo(string);
-
- const string& name() const {return name_;};
- const string& permissions() const {return permissions_;};
- const string& owner() const {return owner_;};
- const string& group() const {return group_;};
- const string& size() const {return size_;};
- const string& modified() const {return modified_;};
- const string& linkTo() const {return linkTo_;};
-
-private:
- string sizeInBytes(string);
-
- string name_;
- string permissions_;
- string owner_;
- string group_;
- string size_;
- string modified_;
- string linkTo_;
-};
-
-#endif
diff --git a/src/libUtil/MvPath.cc b/src/libUtil/MvPath.cc
index 636ac25..2bbc754 100644
--- a/src/libUtil/MvPath.cc
+++ b/src/libUtil/MvPath.cc
@@ -95,6 +95,22 @@ MakeIconName ( const char* path, const char* iconPrefix )
return UtProgressiveName2 ( path, iconPrefix );
}
+string
+MakeIconNameFromPath(const string& path)
+{
+ string name;
+
+ // If "user_dir" is not part of the input string then do nothing
+ std::size_t found = path.find(user_dir);
+ if (found == std::string::npos)
+ return name;
+
+ // Build the output string
+ name = path.substr(found+user_dir.size());
+
+ return name;
+}
+
Cached
MakePrinterFileName ( const Cached& path, const Cached& fileName )
{
@@ -203,13 +219,43 @@ MakeProcessName (const char* name)
string
FullPathName( const char* filename )
{
- string fullPath( filename );
- if( *filename != '/' )
- {
- const char* pwd = getenv( "PWD" );
- //std::cout << "PWD = " << pwd << std::endl;
- fullPath = string( pwd ) + string( "/" ) + fullPath;
- //std::cout << "full path = " << fullPath << std::endl;
- }
- return fullPath;
+ string fullPath( filename );
+ if( *filename != '/' )
+ {
+ const char* pwd = getenv( "PWD" );
+ fullPath = string( pwd ) + string( "/" ) + fullPath;
+ }
+
+ return fullPath;
+}
+
+string
+UserTempCachePath()
+{
+ string tmpdir = getenv("MV_TMPDIR_LINK");
+ string fname = user_dir + "/System/" + tmpdir + "/";
+
+ return fname;
+}
+
+string
+MakeAbsolutePath( const char* path, const char* dir )
+{
+ // Consistency check
+ if ( !path )
+ return dir ? string(dir) : string("");
+
+ // If input parameter is already an absolute path then returns it.
+ // Make sure that the file exists
+ if ( path[0] == '/' && FileCanBeOpened(path,"r") )
+ return string(path);
+
+ // Build an absolute path
+ string upath;
+ if ( dir )
+ upath = dir + string("/") + path;
+ else
+ upath = user_dir + path; // uses METVIEW_USER_DIRECTORY
+
+ return upath;
}
diff --git a/src/libUtil/MvPath.hpp b/src/libUtil/MvPath.hpp
index ae6378d..5b1690a 100644
--- a/src/libUtil/MvPath.hpp
+++ b/src/libUtil/MvPath.hpp
@@ -35,4 +35,6 @@ string FullPathName( const char* filename );
string GetUserDirectory();
+string MakeAbsolutePath( const char*, const char* = 0 );
+
#endif
diff --git a/src/uPlot/HovmoellerView.cc b/src/uPlot/HovmoellerView.cc
index a2dc274..34c9e8a 100644
--- a/src/uPlot/HovmoellerView.cc
+++ b/src/uPlot/HovmoellerView.cc
@@ -148,7 +148,8 @@ void HovmoellerView::SetVariables(const MvRequest &in, bool)
// Send a warning message
if ( swap )
- PlotMod::Instance().MetviewError ("Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped ","WARNING");
+// PlotMod::Instance().MetviewError ("Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped ","WARNING");
+ cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped " << endl;
// Set date limits
bool bDateMin, bDateMax;
diff --git a/src/uPlot/MvIconDataBase.cc b/src/uPlot/MvIconDataBase.cc
index e25b0de..6dcc214 100644
--- a/src/uPlot/MvIconDataBase.cc
+++ b/src/uPlot/MvIconDataBase.cc
@@ -1197,37 +1197,53 @@ bool MvIconDataBase::ExistsInRelation ( MvRelation &relation, const int firstId,
void MvIconDataBase::CreateLink (MvRequest& req)
{
- // If there is no path, do no create a link
- const char* mpath = (const char*)(req("PATH"));
- if ( mpath == 0) return;
+ // If there is no path, do no create a link
+ const char* mpath = (const char*)(req("PATH"));
+ if ( mpath == 0)
+ return;
- // Check if the link has to be created
- const char* createLink = (const char*)req("_CREATE_LINK");
- if ( createLink && strcmp(createLink,"NO") == 0 )
- return;
+ // Check if the link has to be created
+ const char* createLink = (const char*)req("_CREATE_LINK");
+ if ( createLink && strcmp(createLink,"NO") == 0 )
+ return;
- string spath = (const char*)mpath;
- string slink = tempnam(getenv("METVIEW_TMPDIR"),"link");
+ string spath = (const char*)mpath;
+ string slink = tempnam(getenv("METVIEW_TMPDIR"),"link");
- if ( symlink(spath.c_str(),slink.c_str()) != 0 ) //-- create a soft link
- {
- marslog(LOG_WARN,(char*)"MvIconDataBase::CreateLink: unable to create a link");
+ if ( symlink(spath.c_str(),slink.c_str()) != 0 ) //-- create a soft link
+ {
+ marslog(LOG_WARN,(char*)"MvIconDataBase::CreateLink: unable to create a link");
- return; //-- nothing to do => bail out!
- }
+ return; //-- nothing to do => bail out!
+ }
- //-- make sure that soft link is not a dangling ptr!
- if( !FileCanBeOpened( slink.c_str(), "r" ) )
- {
- marslog(LOG_WARN,(char*)"Created soft link is dangling: %s", slink.c_str());
+ //-- make sure that soft link is not a dangling ptr!
+ bool flag = true;
+ if( !FileCanBeOpened( slink.c_str(), "r" ) )
+ {
+ // Try to use parameter _PATH
+ if ( (const char*)req("_PATH") )
+ {
+ remove(slink.c_str());
+ spath = (const char*)req("_PATH");
+ symlink(spath.c_str(),slink.c_str());
+ if ( !FileCanBeOpened( slink.c_str(), "r" ) )
+ flag = false;
+ }
+ else
+ flag = false;
+ }
+ if ( !flag )
+ {
+ marslog(LOG_WARN,(char*)"Created soft link is dangling: %s", slink.c_str());
- return; //-- nothing to do => bail out!
- }
+ return; //-- nothing to do => bail out!
+ }
- req("PATH") = slink.c_str();
- linkList_.push_back(slink.c_str());
+ req("PATH") = slink.c_str();
+ linkList_.push_back(slink.c_str());
- return;
+ return;
}
void MvIconDataBase::DeleteLink ()
diff --git a/test/data/hindcast.grib b/test/data/hindcast.grib
new file mode 100644
index 0000000..d6ac5a0
Binary files /dev/null and b/test/data/hindcast.grib differ
diff --git a/test/macros/CMakeLists.txt b/test/macros/CMakeLists.txt
index d7c2e76..a929536 100644
--- a/test/macros/CMakeLists.txt
+++ b/test/macros/CMakeLists.txt
@@ -36,7 +36,8 @@ endif()
metview_macro_test(MACRO grib_dates.mv
- RESOURCES ../data/fc_data.grib)
+ RESOURCES ../data/fc_data.grib
+ ../data/hindcast.grib)
metview_macro_test(MACRO grib_nearest_gridpoint.mv
RESOURCES ../data/t1000_LL_1x1.grb
diff --git a/test/macros/grib_dates.mv b/test/macros/grib_dates.mv
index 56f7035..9282217 100644
--- a/test/macros/grib_dates.mv
+++ b/test/macros/grib_dates.mv
@@ -12,43 +12,68 @@
# read the original data file
data = read('fc_data.grib')
-bdate = base_date(data)
-vdate = valid_date(data)
# these are what the results should be
correct_bdate = [2016-04-15 12:00:00, 2016-04-15 12:00:00, 2016-04-15 12:00:00, 2016-04-15 12:00:00]
correct_vdate = [2016-04-15 12:00:00, 2016-04-15 18:00:00, 2016-04-16 00:00:00, 2016-04-20 12:00:00]
-# check whether the computed results are correct - note that we can't just say
-# "if bdate <>correct_bdate" because of how these operators work on lists
-if 0 in (bdate = correct_bdate) then
- print('base dates are not the same:')
- print('reference: ', correct_bdate)
- print('computed : ', bdate)
- fail()
-end if
-
-if 0 in (vdate = correct_vdate) then
- print('valid dates are not the same:')
- print('reference: ', correct_vdate)
- print('computed : ', vdate)
- fail()
-end if
-
-
-# quick check to make sure that we return single dates if given single fields
-bdate1 = base_date(data[1])
-if (type(bdate1) <> 'date' or (bdate1 <> correct_bdate[1])) then
- print('single base date is not the same:')
- print('reference: ', correct_bdate[1])
- print('computed : ', bdate1)
- fail()
-end if
-
-vdate1 = valid_date(data[1])
-if (type(vdate1) <> 'date' or (vdate1 <> correct_vdate[1])) then
- print('single valid date is not the same:')
- print('reference: ', correct_vdate[1])
- print('computed : ', vdate1)
- fail()
-end if
+check_dates(data, correct_bdate, correct_vdate)
+
+
+# same for hindcast data
+data = read('hindcast.grib')
+
+# these are what the results should be
+correct_bdate = [2013-05-12 00:00:00, 2013-05-12 00:00:00, 2013-05-12 00:00:00,
+ 2013-05-12 00:00:00, 2013-05-12 00:00:00, 2013-05-12 00:00:00]
+correct_vdate = [2013-05-12 00:00:00, 2013-05-12 06:00:00, 2013-05-13 00:00:00,
+ 2013-05-13 12:00:00, 2013-05-14 00:00:00, 2013-05-15 00:00:00]
+
+check_dates(data, correct_bdate, correct_vdate)
+
+
+
+# ----------------------------------------------------------------------------
+# Function : check_dates
+# ----------------------------------------------------------------------------
+
+function check_dates (data: fieldset, correct_bdate: list, correct_vdate: list)
+
+ bdate = base_date(data)
+ vdate = valid_date(data)
+
+ # check whether the computed results are correct - note that we can't just say
+ # "if bdate <>correct_bdate" because of how these operators work on lists
+ if 0 in (bdate = correct_bdate) then
+ print('base dates are not the same:')
+ print('reference: ', correct_bdate)
+ print('computed : ', bdate)
+ fail()
+ end if
+
+ if 0 in (vdate = correct_vdate) then
+ print('valid dates are not the same:')
+ print('reference: ', correct_vdate)
+ print('computed : ', vdate)
+ fail()
+ end if
+
+
+ # quick check to make sure that we return single dates if given single fields
+ bdate1 = base_date(data[1])
+ if (type(bdate1) <> 'date' or (bdate1 <> correct_bdate[1])) then
+ print('single base date is not the same:')
+ print('reference: ', correct_bdate[1])
+ print('computed : ', bdate1)
+ fail()
+ end if
+
+ vdate1 = valid_date(data[1])
+ if (type(vdate1) <> 'date' or (vdate1 <> correct_vdate[1])) then
+ print('single valid date is not the same:')
+ print('reference: ', correct_vdate[1])
+ print('computed : ', vdate1)
+ fail()
+ end if
+
+end check_dates
diff --git a/test/macros/plot_coast_order.mv b/test/macros/plot_coast_order.mv
deleted file mode 100644
index 810e2cc..0000000
--- a/test/macros/plot_coast_order.mv
+++ /dev/null
@@ -1 +0,0 @@
-#Metview Macro
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/metview.git
More information about the debian-science-commits
mailing list