Hi King, I think that your type of dataset isn't supported at the moment, due to the presence of 2D non-independent coordinate variables. https://docs.geoserver.org/stable/en/user/extensions/netcdf/netcdf.html#notes-on-supported-netcdfs
Scroll down that paragraph to the 2nd screenshot with ToolsUI. Based on what I see from your ncml output that screenshoot looks very similar to your situation. Regards, Daniele On Thu, Dec 5, 2019 at 2:43 PM King Wang via Geoserver-users < geoserver-users@lists.sourceforge.net> wrote: > Hi all, > I am running into an error when trying to create a WMS for a netcdf file > in GeoServer. > The file's ncml is attached at the end of email below. > The error from the geoserver console is: > Could not list layers for this store, an error occurred retrieving them: > Failed to create reader from file://C:\work\netcdf\TSUV.nc and hints Hints: > REPOSITORY = org.geoserver.catalog.CatalogRepository@24cf7e4b > > But from the server (jetty) log, the trace is: > Caused by: java.lang.StringIndexOutOfBoundsException: String index out of > range: -1 > at java.lang.String.substring(String.java:1967) > at > org.geotools.imageio.netcdf.NetCDFImageReader.settingTypeNames(NetCDFImageReader.java:561) > at > org.geotools.imageio.netcdf.NetCDFImageReader.init(NetCDFImageReader.java:521) > at > org.geotools.imageio.netcdf.NetCDFImageReader.setInput(NetCDFImageReader.java:285) > > > And it thrown from the below NetCDFImageReader.ajav call (geoserver > 2.16.x) > > StringBuilder builder = new StringBuilder(); > for (Name coverage : *coverages*) { > > builder.append(ancillaryFileManager.getTypeName(coverage.getLocalPart())).append(","); > } > String typeNames = builder.toString(); > *typeNames = typeNames.substring(0, typeNames.length() - 1);* > > > I am using geoserver 2.16 with netcdf plugin. From the debugger, I see the > real issue is that the coverage name list is null, and therefore the > substring() call fails with index out of rage error. Then I find that the > following call: > > AncillaryFileManager.getCoveragesNames() call return the empty coverage name > list, > > Does anyone know how to address this error? What exactly the coverage is and > how to fix it? Again I have the ncml attached right below. (the nc file is > over 1GB with data, not attached). Also the file is generated following GDT > convention. Does GS netcdf plugin support GDT? > > > <?xml version="1.0" encoding="UTF-8"?> > <ncml:netcdf xmlns:ncml=" > http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" > location="C:/work/netcdf/TSUV.nc"> > <ncml:dimension name="x" length="1435" /> > <ncml:dimension name="y" length="1122" /> > <ncml:dimension name="z" length="50" /> > <ncml:dimension name="time_counter" length="1" isUnlimited="true" /> > <ncml:attribute name="author" value="Oceanography" /> > <ncml:attribute name="date" value="24-Nov-2015" /> > <ncml:attribute name="Conventions" value="*GDT 1.2*" /> > <ncml:attribute name="file_name" value="TSUV.nc" /> > <ncml:attribute name="Title" value="data" /> > <ncml:variable name="lon" shape="y x" type="float"> > <ncml:attribute name="units" value="degrees_east" /> > <ncml:attribute name="long_name" value="Longitude" /> > </ncml:variable> > <ncml:variable name="lat" shape="y x" type="float"> > <ncml:attribute name="units" value="degrees_north" /> > <ncml:attribute name="long_name" value="Latitude" /> > </ncml:variable> > <ncml:variable name="depth" shape="z" type="double"> > <ncml:attribute name="units" value="meters" /> > <ncml:attribute name="long_name" value="depth at differet layer" /> > </ncml:variable> > <ncml:variable name="time_counter" shape="time_counter" type="double" /> > <ncml:variable name="saline" shape="time_counter z y x" type="float"> > <ncml:attribute name="units" value="PSU" /> > <ncml:attribute name="long_name" value="salinity" /> > </ncml:variable> > <ncml:variable name="temper" shape="time_counter z y x" type="float"> > <ncml:attribute name="units" value="degress" /> > <ncml:attribute name="long_name" value="temperature" /> > </ncml:variable> > <ncml:variable name="U" shape="time_counter z y x" type="float"> > <ncml:attribute name="units" value="m/s" /> > <ncml:attribute name="long_name" value="zonal velocity - positive > eastward" /> > </ncml:variable> > <ncml:variable name="V" shape="time_counter z y x" type="float"> > <ncml:attribute name="units" value="m/s" /> > <ncml:attribute name="long_name" value="meridional velocity - positive > northward" /> > </ncml:variable> > </ncml:netcdf> > > Thanks, > King > _______________________________________________ > 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 > -- 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 Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users