diff --git a/build.gradle b/build.gradle index e18abef9..a466923f 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ allprojects { // locoslab libraries and code versionGeometry = '1.4.0' versionCarta = '1.3.0' - versionGrib2 = '1.0.1' + versionGrib2 = '1.0.2' versionAuth = '1.1.0' // tools versionCli = '1.4' diff --git a/service-data/src/main/java/com/mowesta/data/dwd/NumericPrediction.java b/service-data/src/main/java/com/mowesta/data/dwd/NumericPrediction.java index 864df51b..14d9255a 100644 --- a/service-data/src/main/java/com/mowesta/data/dwd/NumericPrediction.java +++ b/service-data/src/main/java/com/mowesta/data/dwd/NumericPrediction.java @@ -19,9 +19,9 @@ import com.locoslab.library.grib2.Grib2Data; import com.locoslab.library.grib2.Grib2File; import com.locoslab.library.grib2.data.DoubleArray; import com.locoslab.library.grib2.decoder.BitmapInterpreter; +import com.locoslab.library.grib2.decoder.CcsdsDataDecoder; import com.locoslab.library.grib2.decoder.RegularGridDecoder; import com.locoslab.library.grib2.decoder.RotatedGridDecoder; -import com.locoslab.library.grib2.decoder.SimpleDataDecoder; import com.locoslab.library.grib2.template.product.ForecastProduct; import com.mowesta.data.ftp.FileStatus; import com.mowesta.data.ftp.FileStatusListener; @@ -33,772 +33,750 @@ import com.mowesta.data.process.util.FileNameComparator; */ public class NumericPrediction { - /** - * The extension of the data files. - */ - private static final String GRIB_EXTENSION = "grib2.bz2"; + /** + * The extension of the data files. + */ + private static final String GRIB_EXTENSION = "grib2.bz2"; - /** - * A enum to describe the coordinate system used to represent locations. - * - * @author Marcus - * - */ - public enum CoordinateSystem { - /** - * A regular grid. - */ - REGULAR("regular", true), - /** - * A rotated grid. - */ - ROTATED("rotated", true), - /** - * A icosahedral system. - */ - ICOSAHEDRAL("icosahedral", false); + /** + * A enum to describe the coordinate system used to represent locations. + * + * @author Marcus + * + */ + public enum CoordinateSystem { + /** + * A regular grid. + */ + REGULAR("regular", true), + /** + * A rotated grid. + */ + ROTATED("rotated", true), + /** + * A icosahedral system. + */ + ICOSAHEDRAL("icosahedral", false); - /** - * The string to filter files. - */ - private final String filter; + /** + * The string to filter files. + */ + private final String filter; - /** - * A flag to indicate whether the values are computed from a grid definition. - */ - private final boolean computed; + /** + * A flag to indicate whether the values are computed from a grid definition. + */ + private final boolean computed; - /** - * Creates a new coordinate system. - * - * @param filter - * The keyword to filter. - * @param computed - * A boolean to indicate whether the values are computed. - */ - private CoordinateSystem(String filter, boolean computed) { - this.filter = filter; - this.computed = computed; - } + /** + * Creates a new coordinate system. + * + * @param filter The keyword to filter. + * @param computed A boolean to indicate whether the values are computed. + */ + private CoordinateSystem(String filter, boolean computed) { + this.filter = filter; + this.computed = computed; + } - /** - * Returns the keyword to filter files. - * - * @return The filter. - */ - public String getFilter() { - return filter; - } + /** + * Returns the keyword to filter files. + * + * @return The filter. + */ + public String getFilter() { + return filter; + } - /** - * Returns true if the values of the positions are computed from a grid - * definition. False if they shall be read from a file. - * - * @return True if the coordinates are computed, false otherwise. - */ - public boolean isComputed() { - return computed; - } + /** + * Returns true if the values of the positions are computed from a grid + * definition. False if they shall be read from a file. + * + * @return True if the coordinates are computed, false otherwise. + */ + public boolean isComputed() { + return computed; + } - } + } - /** - * The predictions that we use to download data. - * - * @author Marcus - */ - public enum PredictionType { - /** - * The global icon prediction. - */ - ICON_GLOBAL("opendata.dwd.de", "weather/nwp/icon/grib/00/", 0, CoordinateSystem.ICOSAHEDRAL, 113), - /** - * The european icon prediction. - */ - ICON_EUROPE("opendata.dwd.de", "weather/nwp/icon-eu/grib/00/", 0, CoordinateSystem.REGULAR, 93), - /** - * The cosmo d2 prediction (the 3 o'clock prediction has more data, but sizes - * vary across variables). - */ - COSMO_EUROPE("opendata.dwd.de", "weather/nwp/icon-d2/grib/03/", 3, CoordinateSystem.ICOSAHEDRAL, 49); + /** + * The predictions that we use to download data. + * + * @author Marcus + */ + public enum PredictionType { + /** + * The global icon prediction. + */ + ICON_GLOBAL("opendata.dwd.de", "weather/nwp/icon/grib/00/", 0, CoordinateSystem.ICOSAHEDRAL, 113), + /** + * The european icon prediction. + */ + ICON_EUROPE("opendata.dwd.de", "weather/nwp/icon-eu/grib/00/", 0, CoordinateSystem.REGULAR, 93), + /** + * The cosmo d2 prediction (the 3 o'clock prediction has more data, but sizes + * vary across variables). + */ + COSMO_EUROPE("opendata.dwd.de", "weather/nwp/icon-d2/grib/03/", 3, CoordinateSystem.ICOSAHEDRAL, 49); - /** - * The number of files expected in variant data folders. - */ - private int files; - /** - * The coordinate system used by the prediction. - */ - private CoordinateSystem system; - /** - * The remote folder on the server. - */ - private String folder; - /** - * The server name. - */ - private String server; + /** + * The number of files expected in variant data folders. + */ + private int files; + /** + * The coordinate system used by the prediction. + */ + private CoordinateSystem system; + /** + * The remote folder on the server. + */ + private String folder; + /** + * The server name. + */ + private String server; - /** - * The hour when the prediction is generated. - */ - private int hour; + /** + * The hour when the prediction is generated. + */ + private int hour; - /** - * Creates a new prediction. - * - * @param server - * The server name. - * @param folder - * The remote folder. - * @param system - * The coordinate system used by the simulation. - * @param files - * The number of files in for time variant variables. - */ - private PredictionType(String server, String folder, int hour, CoordinateSystem system, int files) { - this.server = server; - this.folder = folder; - this.hour = hour; - this.system = system; - this.files = files; - } + /** + * Creates a new prediction. + * + * @param server The server name. + * @param folder The remote folder. + * @param system The coordinate system used by the simulation. + * @param files The number of files in for time variant variables. + */ + private PredictionType(String server, String folder, int hour, CoordinateSystem system, int files) { + this.server = server; + this.folder = folder; + this.hour = hour; + this.system = system; + this.files = files; + } - /** - * Returns the hour when the prediction is made. - * - * @return The hour. - */ - public int getHour() { - return hour; - } + /** + * Returns the hour when the prediction is made. + * + * @return The hour. + */ + public int getHour() { + return hour; + } - /** - * The number of files for time variant variables. - * - * @return The number of files for time variant variables. - */ - public int getFiles() { - return files; - } + /** + * The number of files for time variant variables. + * + * @return The number of files for time variant variables. + */ + public int getFiles() { + return files; + } - /** - * The folder on the server. - * - * @return The folder on the server. - */ - public String getFolder() { - return folder; - } + /** + * The folder on the server. + * + * @return The folder on the server. + */ + public String getFolder() { + return folder; + } - /** - * The name of the ftp server. - * - * @return The name of the ftp server. - */ - public String getServer() { - return server; - } + /** + * The name of the ftp server. + * + * @return The name of the ftp server. + */ + public String getServer() { + return server; + } - /** - * Returns the coordinate system used by the simulation. - * - * @return The coordinate system. - */ - public CoordinateSystem getSystem() { - return system; - } + /** + * Returns the coordinate system used by the simulation. + * + * @return The coordinate system. + */ + public CoordinateSystem getSystem() { + return system; + } - } + } - /** - * An enumeration with the variables. - * - * @author Marcus - */ - public enum Variable { - /** - * The latitudes of the triangles. - */ - CLAT("clat", true), - /** - * The longitudes of the triangles. - */ - CLON("clon", true), - /** - * The latitudes of regular grids. - */ - RLAT("rlat", true), - /** - * The longitudes of regular grids. - */ - RLON("rlon", true), - /** - * The surface height. - */ - HSURF("hsurf", true), - /** - * The plant coverage. - */ - PLCOV("plcov", true), - /** - * The soil type. - */ - SOILTYP("soiltyp", true), - /** - * The snow height. - */ - HSNOW("h_snow", false), - /** - * The relative humditity. - */ - RELHUM2M("relhum_2m", false), - /** - * The temperature in 2m. - */ - T2M("t_2m", false), - /** - * The total cloud coverage. - */ - CLCT("clct_mod", false), - /** - * The cloud depth. - */ - CLDEPTH("cldepth", false), - /** - * The pressure level at sea height. - */ - PMSL("pmsl", false), - /** - * The pressure level at the surface. - */ - PS("ps", false), - /** - * The total precipitation (accumulated (!)). - */ - PREC("tot_prec", false), + /** + * An enumeration with the variables. + * + * @author Marcus + */ + public enum Variable { + /** + * The latitudes of the triangles. + */ + CLAT("clat", true), + /** + * The longitudes of the triangles. + */ + CLON("clon", true), + /** + * The latitudes of regular grids. + */ + RLAT("rlat", true), + /** + * The longitudes of regular grids. + */ + RLON("rlon", true), + /** + * The surface height. + */ + HSURF("hsurf", true), + /** + * The plant coverage. + */ + PLCOV("plcov", true), + /** + * The soil type. + */ + SOILTYP("soiltyp", true), + /** + * The snow height. + */ + HSNOW("h_snow", false), + /** + * The relative humditity. + */ + RELHUM2M("relhum_2m", false), + /** + * The temperature in 2m. + */ + T2M("t_2m", false), + /** + * The total cloud coverage. + */ + CLCT("clct_mod", false), + /** + * The cloud depth. + */ + CLDEPTH("cldepth", false), + /** + * The pressure level at sea height. + */ + PMSL("pmsl", false), + /** + * The pressure level at the surface. + */ + PS("ps", false), + /** + * The total precipitation (accumulated (!)). + */ + PREC("tot_prec", false), - /** - * The zonal wind. at 10m height. - */ - U10M("u_10m", false), + /** + * The zonal wind. at 10m height. + */ + U10M("u_10m", false), - /** - * The meridional wind at 10m height. - */ - V10M("v_10m", false), + /** + * The meridional wind at 10m height. + */ + V10M("v_10m", false), - /** - * The weather interpretation type. - */ - WW("ww", false); + /** + * The weather interpretation type. + */ + WW("ww", false); - /** - * The name of the folder. - */ - private final String folder; + /** + * The name of the folder. + */ + private final String folder; - /** - * Determines whether the variable is time invariant. - */ - private final boolean invariant; + /** + * Determines whether the variable is time invariant. + */ + private final boolean invariant; - /** - * Creates a new variable. - * - * @param folder - * The folder name. - * @param invariant - * True if time invariant. - */ - private Variable(String folder, boolean invariant) { - this.folder = folder; - this.invariant = invariant; - } + /** + * Creates a new variable. + * + * @param folder The folder name. + * @param invariant True if time invariant. + */ + private Variable(String folder, boolean invariant) { + this.folder = folder; + this.invariant = invariant; + } - /** - * Returns the folder name. - * - * @return The folder name. - */ - public String getFolder() { - return folder; - } + /** + * Returns the folder name. + * + * @return The folder name. + */ + public String getFolder() { + return folder; + } - /** - * Returns true if the variable is time invariant. - * - * @return True if time invariant, false otherwise. - */ - public boolean isInvariant() { - return invariant; - } - }; + /** + * Returns true if the variable is time invariant. + * + * @return True if time invariant, false otherwise. + */ + public boolean isInvariant() { + return invariant; + } + }; - /** - * Utility class used to represent time stamps. - * - * @author Marcus - */ - public static class Time implements Comparable