Hi Matthew, Hi Andrea,

Thank you for your answers!
Unfortunately we haven't found a solution yet why geoserver has problems to 
create webservices from a netCDF data file with a 4d structure (lat, lon, time, 
entity).
Still we can't add the netCDF files as "netcdf store" in the geoserver to list 
the layers.

@Andrea
The nesting/grouping doesn't seem to be the problem, since geoserver can create 
webservices given a 3dimensional netCDF structure (lat, lon, time) with the 
same nesting.

@Matthew
we have modified the structure from the netCDF as you described. Would it be 
possible to share your 4d netCDF with us so that we can compare?

Description of netCDFs
All:
                * 4D format, with metric group but without scenario group
                * the two cubes have different orders for the dimensions, to 
test that

martins_v1.nc -> 
here<https://www.dropbox.com/s/bgeuy8mgig4ivp2/martins_v1.nc?dl=0>
                * has no attributes at all (only CRS has two: 'GeoTransform' 
and 'spatial_ref' and the cubes each have a 'grid_mapping' attribute that 
points to CRS)
                * metric_1/ebv_cube: pure order of dimensions: "entity", 
"time", "lat", "lon"
                * metric_2/ebv_cube: pure order of dimensions: "time", 
"entity", "lat", "lon" (COARDS makes me think so)

martins_v2.nc -> 
here<https://www.dropbox.com/s/a271xqcb9bipvmu/martins_v2.nc?dl=0>
                * has the same attributes as the stackexchange example (+ 
'axis' because of COARDS)
                * metric_1/ebv_cube: pure sequence of dimensions: "entity", 
"time", "lat", "lon"
                * metric_2/ebv_cube: pure order of dimensions: "time", 
"entity", "lat", "lon" (COARDS makes me think so)

Resources:
https://gis.stackexchange.com/questions/444317/geoserver-java-error-when-adding-layer-from-netcdf-based-store/444686#444686
https://geos-chem.readthedocs.io/en/latest/geos-chem-shared-docs/supplemental-guides/coards-guide.html

Error message:
Could not list layers for this store, an error occurred retrieving them: Failed 
to create reader from file:data/netCDF/martins_v1.nc and hints Hints: 
REPOSITORY = 
org.geoserver.catalog.CatalogRepository@296160e2<mailto:org.geoserver.catalog.CatalogRepository@296160e2>
 EXECUTOR_SERVICE = 
java.util.concurrent.ThreadPoolExecutor@3082f4d2[Running<mailto:java.util.concurrent.ThreadPoolExecutor@3082f4d2[Running>,
 pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] 
System defaults: COMPARISON_TOLERANCE = 1.0E-8 FILTER_FACTORY = 
FilterFactoryImpl STYLE_FACTORY = StyleFactoryImpl FEATURE_FACTORY = 
org.geotools.feature.LenientFeatureFactoryImpl@5ccc684f<mailto:org.geotools.feature.LenientFeatureFactoryImpl@5ccc684f>
 GRID_COVERAGE_FACTORY = GridCoverageFactory TILE_ENCODING = null 
FORCE_LONGITUDE_FIRST_AXIS_ORDER = true FORCE_AXIS_ORDER_HONORING = http 
LENIENT_DATUM_SHIFT = true

Is there anyone in the community who can give us contact to the netcdf plugin 
developer?

Any further help from you and the community is much appreciated!

Thanks!

Best
Christian



Von: Andrea Aime <andrea.a...@geosolutionsgroup.com>
Datum: Samstag, 3. Dezember 2022 um 21:18
An: Christian Langer <christian.lan...@idiv.de>
Cc: "geoserver-users@lists.sourceforge.net" 
<geoserver-users@lists.sourceforge.net>, "Quoss, Luise" <luise.qu...@idiv.de>, 
Henrique Pereira <hpere...@idiv.de>
Betreff: [Extern] Re: [Geoserver-users] Failed to create reader from netCDF

Hi,
I had a quick look and indeed Geoserver is not able to open the files, I see 
errors like:

Caused by: org.geotools.data.DataSourceException: java.io.IOException: 
java.lang.IllegalArgumentException: No valid coverages name to be written
        at 
org.geotools.coverage.io.netcdf.NetCDFAccess.<init>(NetCDFAccess.java:130)
        at 
org.geotools.coverage.io.netcdf.NetCDFDriver.connect(NetCDFDriver.java:93)
        at 
org.geotools.coverage.io.impl.DefaultFileDriver.process(DefaultFileDriver.java:231)
        at 
org.geotools.coverage.io.netcdf.NetCDFReader.<init>(NetCDFReader.java:156)
        ... 164 more
Caused by: java.lang.RuntimeException: java.io.IOException: 
java.lang.IllegalArgumentException: No valid coverages name to be written
        at 
org.geotools.imageio.netcdf.NetCDFImageReader.setInput(NetCDFImageReader.java:307)
        at java.desktop/javax.imageio.ImageReader.setInput(ImageReader.java:380)
        at 
org.geotools.coverage.io.netcdf.NetCDFAccess.<init>(NetCDFAccess.java:119)
        ... 167 more
Caused by: java.io.IOException: java.lang.IllegalArgumentException: No valid 
coverages name to be written
        at 
org.geotools.imageio.netcdf.NetCDFImageReader.initIndex(NetCDFImageReader.java:414)
        at 
org.geotools.imageio.netcdf.NetCDFImageReader.init(NetCDFImageReader.java:541)
        at 
org.geotools.imageio.netcdf.NetCDFImageReader.setInput(NetCDFImageReader.java:305)
        ... 169 more
Caused by: java.lang.IllegalArgumentException: No valid coverages name to be 
written
        at 
org.geotools.imageio.netcdf.AncillaryFileManager.storeIndexer(AncillaryFileManager.java:390)
        at 
org.geotools.imageio.netcdf.AncillaryFileManager.writeToDisk(AncillaryFileManager.java:382)
        at 
org.geotools.imageio.netcdf.NetCDFImageReader.initIndex(NetCDFImageReader.java:402)
        ... 171 more

According to the 
documentation<https://docs.geoserver.org/stable/en/user/extensions/netcdf/netcdf.html#notes-on-supported-netcdfs>,
 GeoServer should be able to open files conforming to the COARDS 
<https://geos-chem.readthedocs.io/en/latest/geos-chem-shared-docs/supplemental-guides/coards-guide.html>
 convention...
checking the files with PanoplyJ I see a grouping/netsting construct I haven't 
seen before, which does not seem to appear
in COARDS either:

[image.png]

It might be possible to have GeoServer open these files, but I guess that would 
need some 
code<https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-fixes,-improvements-and-new-features-in-GeoServer>
modifications in the NetCDF 
driver<https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-fixes,-improvements-and-new-features-in-GeoServer>.

Cheers
Andrea


Von: Matthew Levey <mle...@seaspatial.com<mailto:mle...@seaspatial.com>>
Organisation: SeaSpatial Consulting
Datum: Montag, 28. November 2022 um 20:12
An: Christian Langer <christian.lan...@idiv.de<mailto:christian.lan...@idiv.de>>
Betreff: [Extern] Re: [Geoserver-users] Failed to create reader from netCDF

Hi Christian,

I ran into a similar problem using surface current data from Copernicus 
(marine.copernicus.eu). I was using xarray and found the solution was to copy 
the variable attributes of a known working NetCDF file. Here is a link to my 
question and self-answer on GIS StackExchange: 
https://gis.stackexchange.com/questions/444317/geoserver-java-error-when-adding-layer-from-netcdf-based-store/444686#444686

I hope this helps!

regards,

Matt Levey
On 11/24/2022 4:47 AM, Langer, Christian wrote:
Dear geoserver community,

we are a team from a scientific institute in Leipzig/Germany and work with 
geospatial data, especially with netCDFs files.
We would like to create web services from netCDFs files with the geoserver 
netcdf plugin, unfortunately the plugin cannot read our netCDFs structure.

To get an idea of the structure of the netCDFs you can check this page: 
https://git.idiv.de/lq39quba/ebv_data_standard
Two datasets that we propose for ‘taking a look’ are the following:

  1.  
https://portal.geobon.org/data/upload/1/public/martins_comcom_id1_20220208_v1.nc
  2.  
https://portal.geobon.org/data/upload/5/public/baisero_spepop_id5_20220215_v2.nc

We are using GeoServer 2.20.1 with the netCDF plugin 
(geoserver-2.20.1-netcdf-plugin.zip) on a Tomcat 9 locally on a Mac 
(localhost:8080).
We have followed the tutorial: 
https://geoserver.geo-solutions.it/multidim/multidim/netcdf/netcdf_config.html#netcdf

We are getting always the error: "Could not list layers for this store, an 
error occurred retrieving them: Failed to create reader from file" (please see 
screenshot attached). It seems geoserver has problems to handle the 4th 
dimension. Complete log file here: 
geoserver.log<https://portal.idiv.de/owncloud/index.php/s/EL95nr96CwPSisy>
We have tried the same with a netCDF structure in 3d and it works like a charm 
- geoserver could list the layers (see screenshot attached).

Could we get a contact to the developer of the netCDF Plugin? Or can you help 
us directly?
Any help is much appreciated!
Thanks in advance.

Best regards,
Christian Langer



Christian Langer
Web-GIS Programmer / Web-GIS Programmierer
German Centre for Integrative Biodiversity Research (iDiv) Halle-Jena-Leipzig


--
[cid:part1.c480sEmI.CyKx7En6@seaspatial.com]
_______________________________________________
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


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to