Skip to content
Snippets Groups Projects
Commit 8ffab95b authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added features to weather elements

parent f71d042a
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
package no.bioforsk.vips.entity; package no.bioforsk.vips.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
/** /**
...@@ -32,9 +31,10 @@ import java.util.Date; ...@@ -32,9 +31,10 @@ import java.util.Date;
public class WeatherObservation implements Comparable{ public class WeatherObservation implements Comparable{
public final static Integer LOG_INTERVAL_ID_1H = 1; public final static Integer LOG_INTERVAL_ID_1H = 1;
public final static Integer LOG_INTERVAL_ID_3H = 3;
public final static Integer LOG_INTERVAL_ID_6H = 6;
public final static Integer LOG_INTERVAL_ID_1D = 2; public final static Integer LOG_INTERVAL_ID_1D = 2;
private String elementMeasurementTypeId; private String elementMeasurementTypeId;
private Integer logIntervalId; private Integer logIntervalId;
private Date timeMeasured; private Date timeMeasured;
...@@ -105,6 +105,7 @@ public class WeatherObservation implements Comparable{ ...@@ -105,6 +105,7 @@ public class WeatherObservation implements Comparable{
return "Observation \n" + return "Observation \n" +
"elementMeasurementTypeId=" + this.getElementMeasurementTypeId() + "\n" + "elementMeasurementTypeId=" + this.getElementMeasurementTypeId() + "\n" +
"timeMeasured=" + this.getTimeMeasured().toString() + "\n" + "timeMeasured=" + this.getTimeMeasured().toString() + "\n" +
"logIntervalId=" + this.getLogIntervalId().toString() + "\n" +
"value=" + this.getValue(); "value=" + this.getValue();
} }
......
...@@ -38,16 +38,24 @@ public class WeatherElements { ...@@ -38,16 +38,24 @@ public class WeatherElements {
* Maximum temperature (Celcius) * Maximum temperature (Celcius)
*/ */
public static final String TEMPERATURE_MAXIMUM = "TX"; public static final String TEMPERATURE_MAXIMUM = "TX";
/**
* Instantaneous temperature (Celcius)
*/
public static final String TEMPERATURE_INSTANTANEOUS = "TT";
/** /**
* Aggregated rainfall (millimeters) * Aggregated rainfall (millimeters)
*/ */
public static final String PRECIPITATION = "RR"; public static final String PRECIPITATION = "RR";
/** /**
* Relative humidity (%) * Average relative humidity (%)
*/
public static final String RELATIVE_HUMIDITY_MEAN = "UM";
/**
* Instantaneous relative humidity (%)
*/ */
public static final String RELATIVE_HUMIDITY = "UM"; public static final String RELATIVE_HUMIDITY_INSTANTANEOUS = "UU";
/** /**
* Global radiation (unit??) * Global radiation (W/sqm)
*/ */
public static final String GLOBAL_RADIATION = "Q0"; public static final String GLOBAL_RADIATION = "Q0";
/** /**
...@@ -55,7 +63,7 @@ public class WeatherElements { ...@@ -55,7 +63,7 @@ public class WeatherElements {
*/ */
public static final String LEAF_WETNESS = "BT"; public static final String LEAF_WETNESS = "BT";
/** /**
* * Average wind speed (meters / second)
*/ */
public static final String WIND_SPEED_2M = "FM2"; public static final String WIND_SPEED_2M = "FM2";
......
...@@ -231,7 +231,7 @@ public class WeatherUtilTest extends TestCase { ...@@ -231,7 +231,7 @@ public class WeatherUtilTest extends TestCase {
{ {
if(obs.getElementMeasurementTypeId().equals(WeatherElements.TEMPERATURE_MEAN)) if(obs.getElementMeasurementTypeId().equals(WeatherElements.TEMPERATURE_MEAN))
TM.add(obs); TM.add(obs);
else if(obs.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY)) else if(obs.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY_MEAN))
UM.add(obs); UM.add(obs);
else if(obs.getElementMeasurementTypeId().equals(WeatherElements.WIND_SPEED_2M)) else if(obs.getElementMeasurementTypeId().equals(WeatherElements.WIND_SPEED_2M))
FM2.add(obs); FM2.add(obs);
...@@ -358,7 +358,7 @@ public class WeatherUtilTest extends TestCase { ...@@ -358,7 +358,7 @@ public class WeatherUtilTest extends TestCase {
{ {
RR.add(o); RR.add(o);
} }
else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY)) else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY_MEAN))
{ {
UM.add(o); UM.add(o);
} }
...@@ -402,7 +402,7 @@ public class WeatherUtilTest extends TestCase { ...@@ -402,7 +402,7 @@ public class WeatherUtilTest extends TestCase {
{ {
RR.add(o); RR.add(o);
} }
else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY)) else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY_MEAN))
{ {
UM.add(o); UM.add(o);
} }
...@@ -437,7 +437,7 @@ public class WeatherUtilTest extends TestCase { ...@@ -437,7 +437,7 @@ public class WeatherUtilTest extends TestCase {
{ {
RR.add(o); RR.add(o);
} }
else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY)) else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY_MEAN))
{ {
UM.add(o); UM.add(o);
} }
...@@ -472,7 +472,7 @@ public class WeatherUtilTest extends TestCase { ...@@ -472,7 +472,7 @@ public class WeatherUtilTest extends TestCase {
{ {
RR.add(o); RR.add(o);
} }
else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY)) else if(o.getElementMeasurementTypeId().equals(WeatherElements.RELATIVE_HUMIDITY_MEAN))
{ {
UM.add(o); UM.add(o);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment