This issue is still plaguing me, after upgrading to Geoserver 2.22.1
Based on Daniele's explanation, I changed the code where GRIBFormat checks
for FileFormat.GRIB, rather than just checking for extension.
Attached is a diff with a proposed change in GRIBFormat. java
My Geotiff files retain the original granule name, however they are all
Geotiffs:
find . -name '*grb*' -exec gdalinfo {} \;|grep Driver|uniq
Driver: GTiff/GeoTIFF
Here is a WMS request where the grib plugin is deployed after this change,
otherwise images are all black with all values equal to zero:
https://wfas.firenet.gov/geoserver/rtma/wms?service=WMS&version=1.1.0&request=GetMap&layers=rtma%3ARelative_humidity&bbox=-3272417.25%2C-265067.375%2C2683186.5%2C3790838.5&width=768&height=523&srs=EPSG%3A45558&styles=&format=application/openlayers
Or is it better to submit a JIRA issue?
Thanks in advance,
Alex
On Thu, Oct 24, 2019 at 5:23 AM Simone Giannecchini <
[email protected]> wrote:
> Daniele,
> shall we open an issue to track this strange behavior?
>
> Regards,
> Simone Giannecchini
> ==
> GeoServer Professional Services from the experts!
> Visit http://bit.ly/gs-services for more information.
> ==
> Ing. Simone Giannecchini
> @simogeo
> Founder/Director
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 333 8128928
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
> Con riferimento alla normativa sul trattamento dei dati personali
> (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati
> “GDPR”), si precisa che ogni circostanza inerente alla presente email
> (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui
> conoscenza è riservata al/i solo/i destinatario/i indicati dallo
> scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a
> cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato
> se potesse darmene notizia.
>
> This email is intended only for the person or entity to which it is
> addressed and may contain information that is privileged, confidential
> or otherwise protected from disclosure. We remind that - as provided
> by European Regulation 2016/679 “GDPR” - copying, dissemination or use
> of this e-mail or the information herein by anyone other than the
> intended recipient is prohibited. If you have received this email by
> mistake, please notify us immediately by telephone or e-mail.
>
> On Wed, Oct 23, 2019 at 12:48 PM Alexander Petkov <[email protected]>
> wrote:
> >
> > Hello Daniele:
> >
> > gdal_translate with '-co PROFILE=GeoTIFF' solves this problem.
> >
> > The default GDALGeoTIFF writes extra metadata tags, which seem to
> > envoke the NetCDFImageReaderSpi
> >
> > Alex
> >
> > On 10/23/19, Daniele Romagnoli <[email protected]>
> wrote:
> > > Hi Alex,
> > > Actually I was partially wrong.
> > >
> > > The GribFormat simply does a filename check:
> > >
> https://github.com/geotools/geotools/blob/master/modules/plugin/coverage-multidim/grib/src/main/java/org/geotools/coverage/io/grib/GRIBFormat.java
> > >
> > >
> > > Is the NetCDFImageReaderSpi which actually does a real format check
> based
> > > on magic numbers:
> > >
> https://github.com/geotools/geotools/blob/master/modules/plugin/coverage-multidim/netcdf/src/main/java/org/geotools/imageio/netcdf/NetCDFImageReaderSpi.java#L178
> > >
> > >
> > >
> https://github.com/geotools/geotools/blob/master/modules/plugin/coverage-multidim/netcdf/src/main/java/org/geotools/imageio/netcdf/utilities/NetCDFUtilities.java#L705
> > >
> > >
> > > I think that we may need to revisit that "accepts" method.
> > >
> > > Regards,
> > > Daniele
> > >
> > >
> > >
> > > On Wed, Oct 23, 2019 at 11:57 AM Alexander Petkov <[email protected]>
> > > wrote:
> > >
> > >> >> So my first question is:
> > >> >> are you pretty sure that the files you are trying to mosaic are
> > >> >> actually
> > >> >> GeoTiffs and not NetCDFs/Gribs?
> > >> >> Can you run a gdalinfo on one of them?
> > >>
> > >> gdalinfo confirms that all files are Geotiffs:
> > >>
> > >> for f in `find . -path './rtma2p5.201910*' -type f`;do gdalinfo ${f}
> > >> |grep Driver ;done|uniq
> > >> Driver: GTiff/GeoTIFF
> > >>
> > >>
> > >> >> Second question: any chance that you are trying to create a mosaic
> on
> > >> top
> > >> >> of a folder containing both GeoTiffs and NetCDFs?
> > >>
> > >> My Geotiff and .properties files are in their own subdirectory.
> > >>
> > >> >> In that case, if the first file to be analyzed by the mosaic
> > >> configurator
> > >> >> is a NetCDF, it will be used as reference format.
> > >> >>
> > >> >> Please, let us know.
> > >> >> Regards,
> > >> >> Daniele
> > >>
> > >> Thanks for giving your thoughts on this
> > >>
> > >> Alex
> > >>
> > >
> > >
> > > --
> > > Regards,
> > > Daniele Romagnoli
> > > ==
> > > GeoServer Professional Services from the experts! Visit
> > > http://goo.gl/it488V
> > > for more information.
> > > ==
> > >
> > > Ing. Daniele Romagnoli
> > > Senior Software Engineer
> > >
> > > GeoSolutions S.A.S.
> > > Via di Montramito 3/A
> > > 55054 Massarosa (LU)
> > > Italy
> > > phone: +39 0584 962313
> > > fax: +39 0584 1660272
> > >
> > > http://www.geo-solutions.it
> > > http://twitter.com/geosolutions_it
> > >
> > > -------------------------------------------------------
> > >
> > > Con riferimento alla normativa sul trattamento dei dati personali
> (Reg. UE
> > > 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
> > > precisa che ogni circostanza inerente alla presente email (il suo
> > > contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
> > > riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
> > > messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
> > > operazione è illecita. Le sarei comunque grato se potesse darmene
> notizia.
> > >
> > > This email is intended only for the person or entity to which it is
> > > addressed and may contain information that is privileged, confidential
> or
> > > otherwise protected from disclosure. We remind that - as provided by
> > > European Regulation 2016/679 “GDPR” - copying, dissemination or use of
> this
> > > e-mail or the information herein by anyone other than the intended
> > > recipient is prohibited. If you have received this email by mistake,
> please
> > > notify us immediately by telephone or e-mail.
> > >
> >
> >
> > _______________________________________________
> > Geoserver-users mailing list
> >
> > Please make sure you read the following two resources before posting to
> this list:
> > - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> > - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
> >
> > If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
> >
> >
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
diff --git a/modules/plugin/coverage-multidim/grib/src/main/java/org/geotools/coverage/io/grib/GRIBFormat.java b/modules/plugin/coverage-multidim/grib/src/main/java/org/geotools/coverage/io/grib/GRIBFormat.java
index 024285bcc1..9e72fb8b3b 100644
--- a/modules/plugin/coverage-multidim/grib/src/main/java/org/geotools/coverage/io/grib/GRIBFormat.java
+++ b/modules/plugin/coverage-multidim/grib/src/main/java/org/geotools/coverage/io/grib/GRIBFormat.java
@@ -17,12 +17,14 @@
package org.geotools.coverage.io.grib;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.geotools.coverage.io.netcdf.NetCDFFormat;
import org.geotools.imageio.netcdf.utilities.NetCDFUtilities;
+import org.geotools.imageio.netcdf.utilities.NetCDFUtilities.FileFormat;
import org.geotools.parameter.DefaultParameterDescriptor;
import org.geotools.parameter.DefaultParameterDescriptorGroup;
import org.geotools.parameter.ParameterGroup;
@@ -88,10 +90,25 @@ public boolean accepts(Object source, Hints hints) {
&& (fileName.contains("grb") || fileName.contains("grib"));
if (fileName.endsWith("ncml") || gribExtension) {
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("File is accepted: " + fileName);
+ FileFormat format = null;
+ try {
+ format = NetCDFUtilities.getFormat(file.toURI());
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (format == FileFormat.GRIB) {
+ if (LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.finest("File is accepted: " + fileName);
+ }
+ return true;
+ } else {
+ if (LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.finest("File is not accepted: " + fileName);
+ }
+ return false;
}
- return true;
}
}
if (LOGGER.isLoggable(Level.FINEST)) {
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
If you want to request a feature or an improvement, also see this:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users