Hi Frank,
If my memory serves me right the current code allows to deal with different
2D grids of the same type (let's say multiple set of GeoX/GeoY grids),
provided that multiple dimensions exist for them, in order to define the
coordinates variables.
Your case is different and your lon/lat variables will be handled as
standard variables (not a coordinate variable, as X and Y will do instead).
So I think that the culprit on your case is still the WKT not being
properly setup on the initial dataset since it uses quotes instead of
double quotes, which result in the reader being unable to recognize the
coordinate reference system for the underlying variables.

WKT spatial reference definition uses double quotes for texts. Since I was
documenting myself on that, I have also looked for some formal
documentation and I have found the specification:
https://portal.opengeospatial.org/files/12-063r5
Chapter 6.1 of the WKT specification reports:


*EXAMPLE KEYWORD1[attribute1,KEYWORD2[attribute2,attribute3]]  *
*Attributes may be from an enumeration, be numbers or be text. Text is
enclosed in double quotes  *

Indeed, the classic: https://spatialreference.org/ref/epsg/4326/prettywkt/

GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.01745329251994328,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]

And same for custom CRS defined in NetCDF.  This is the output from a
netcdf sample provided in GDAL datasets (
https://github.com/OSGeo/gdal/raw/master/autotest/gdrivers/data/cf_lcc2sp.nc
):
PROJCS["unnamed",GEOGCS["unknown",DATUM["unknown",SPHEROID["Sphere",6371200,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic_1SP"],PARAMETER["latitude_of_origin",25],PARAMETER["central_meridian",265],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],PARAMETER["standard_parallel_1",25],UNIT["kilometre",1000,AUTHORITY["EPSG","9036"]]]

And this is how spatial_ref from your sample data is defined
PROJCS['unnamed',GEOGCS['GRS
1980(IUGG,1980)',DATUM['unknown',SPHEROID['GRS80',6378137,298.257222101],TOWGS84[0,0,0,0,0,0,0]],PRIMEM['Greenwich',0],UNIT['degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['latitude_of_origin',0],PARAMETER['central_meridian',18],PARAMETER['scale_factor',1],PARAMETER['false_easting',150000],PARAMETER['false_northing',0],UNIT['Meter',1]]
which uses single quotes instead of required double quotes.

Hope this helps.
Regards,
Daniele


On Tue, Aug 27, 2019 at 8:51 AM Van Der Stelt Frank <
frank.vanderst...@smhi.se> wrote:

> Hi Daniele,
>
> When I open ToolsUI I get five axisTypes, one for *time* and the other
> four for location as you suspected; l*on, lat, GeoX *and* GeoY.*
> You mention that there is code to deal with this case, is that already
> implemented in the NetCDF-plugin?
>
> Thank you for your help!
>
> Kind regards,
>
> Frank
>
> ------------------------------
> *Från:* Daniele Romagnoli [daniele.romagn...@geo-solutions.it]
> *Skickat:* den 26 augusti 2019 16:39
> *Till:* Van Der Stelt Frank
> *Kopia:* Alexander Petkov; geoserver-users@lists.sourceforge.net
> *Ämne:* Re: [Geoserver-users] Geoserver Store NetCDF issue: Could not
> list layers
>
> Hi Frank,
> not 100% sure about the longitude variable issue.
> I'm wondering if, for any reason, the datasets looks like having 4 2D Axis
> (both longitude,latitude and x,y projected coordinate axis) so it's like
> having both meter and degree coordinates being defined and supported (some
> very peculiar datasets contain multiple 2D grids definitions and multiple
> 2D dimensions and there is code to deal with that case).
> If you open the dataset with ToolsUI and go through the "CoordSys" tab,
> how many "axisType" rows is reporting on the bottom table?
>
> The alternative hypothesis I have in mind is that being the dataset a
> projected one, the lon and lat variables are handled as normal 2D variables
> (and not as coordinates since there is no dimensions for them). Being "lon"
> the first variable listed in your NetCDF, it's the first one spotting the
> WKT parsing problem when looking for the associated coordinate reference
> system during the variables scan.
>
> Please, let us know.
> Regards,
> Daniele
>
>
>
> On Thu, Aug 22, 2019 at 10:57 PM Van Der Stelt Frank <
> frank.vanderst...@smhi.se> wrote:
>
>> Thank you for your answer. I looked at this and found that this is a
>> problem in geotools. When the WKT string is parsed the single quotes are
>> changed to double quotes and the CRS factory doesn't like that. So I
>> patched this part of geotools to get around this problem. The question
>> remains why the NetCDF plugin looks at the lon variable at all. That one is
>> included in the crun variable that has the projection defined.
>>
>> Kind regards,
>>
>> Frank van der Stelt
>>
>>
>>
>> ________________________________________
>> Från: Alexander Petkov [green...@gmail.com]
>> Skickat: den 22 augusti 2019 19:48
>> Till: Van Der Stelt Frank
>> Kopia: geoserver-users@lists.sourceforge.net
>> Ämne: Re: [Geoserver-users] Geoserver Store NetCDF issue: Could not list
>> layers
>>
>> First, I would trace why this is happening:
>>
>> org.geotools.coverage.io.netcdf.crs.NetCDFProjection$CRSParser parseWKT
>> WARNING: Unable to setup a CRS from the specified WKT:
>> PROJCS['unnamed',GEOGCS['GRS 1980(IUGG,
>>
>> 1980)',DATUM['unknown',SPHEROID['GRS80',6378137,298.257222101],TOWGS84[0,0,0,0,0,0,0]],PRIMEM['Greenwich',0],UNIT['degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['latitude_of_origin',0],PARAMETER['central_meridian',18],PARAMETER['scale_factor',1],PARAMETER['false_easting',150000],PARAMETER['false_northing',0],UNIT['Meter',1]]
>>
>> Then take it from there.
>>
>> Kind regards,
>> Alex
>>
>>
>> On 8/22/19, Van Der Stelt Frank <frank.vanderst...@smhi.se> wrote:
>> > Hi again,
>> >
>> > I'll try to rephrase the problem. When uploading a NetCDF file I get the
>> > "Could not list layers for this store" problem. The file follows the CF
>> 1.6
>> > convention and can be read by qgis and other NetCDF-readers. I uploaded
>> the
>> > file here.
>> >
>> >
>> https://www.dropbox.com/s/ssanmgozpg16g5p/stockholm_110_historic_crun-monthly_mean.nc?dl=0
>> >
>> > The geoserver log-file says:
>> >
>> > Caused by: java.io.IOException: java.lang.IllegalArgumentException:
>> Unable
>> > to find a CRS for the provided variable: lon
>> >
>> > I added the WKT-string in a file under the user_projections catalogue.
>> > Geoserver can find my CRS but for the lon-variable he still insists on
>> the
>> > projection.
>> >
>> > Does anyone have any clue?
>> >
>> > Here is the NetCDF-header:
>> >
>> >
>> > netcdf stockholm_110_historic_crun-monthly_mean {
>> > dimensions:
>> >         x = 110 ;
>> >         y = 110 ;
>> >         time = UNLIMITED ; // (60 currently)
>> >         bnds = 2 ;
>> > variables:
>> >         float lon(y, x) ;
>> >                 lon:standard_name = "longitude" ;
>> >                 lon:long_name = "longitude" ;
>> >                 lon:units = "degrees_east" ;
>> >                 lon:_CoordinateAxisType = "Lon" ;
>> >                 lon:grid_mapping = "projection" ;
>> >         float lat(y, x) ;
>> >                 lat:standard_name = "latitude" ;
>> >                 lat:long_name = "latitude" ;
>> >                 lat:units = "degrees_north" ;
>> >                 lat:_CoordinateAxisType = "Lat" ;
>> >                 lat:grid_mapping = "projection" ;
>> >         float x(x) ;
>> >                 x:standard_name = "projection_x_coordinate" ;
>> >                 x:long_name = "x coordinate of projection" ;
>> >                 x:units = "m" ;
>> >                 x:axis = "X" ;
>> >         float y(y) ;
>> >                 y:standard_name = "projection_y_coordinate" ;
>> >                 y:long_name = "y coordinate of projection" ;
>> >                 y:units = "m" ;
>> >                 y:axis = "Y" ;
>> >         int projection ;
>> >                 projection:false_easting = 150000. ;
>> >                 projection:false_northing = 0. ;
>> >                 projection:grid_mapping_name = "projection" ;
>> >                 projection:latitude_of_projection_origin = 0. ;
>> >                 projection:longitude_of_central_meridian = 18. ;
>> >                 projection:proj4 = "+proj=tmerc +lat_0=0 +lon_0=18 +k=1
>> > +x_0=150000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m
>> +no_defs" ;
>> >                 projection:scale_factor_at_central_meridian = 1. ;
>> >                 projection:semi_major_axis = 6378137. ;
>> >                 projection:inverse_flattening = 298.257222101 ;
>> >                 projection:spatial_ref = "PROJCS[\"SWEREF99 18
>> > 00\",GEOGCS[\"SWEREF99\",DATUM[\"SWEREF99\",SPHEROID[\"GRS 1980\",
>> > 6378137.0, 298.257222101, AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0.0,
>> 0.0,
>> > 0.0, 0\
>> > .0, 0.0, 0.0, 0.0],AUTHORITY[\"EPSG\",\"6619\"]],PRIMEM[\"Greenwich\",
>> 0.0,
>> > AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",
>> > 0.017453292519943295],AXIS[\"Geodetic latitude\", NORTH],AXIS[\"Geodetic
>> > longitude\", E\
>> > AST],AUTHORITY[\"EPSG\",\"4619\"]],PROJECTION[\"Transverse_Mercator\",
>> > AUTHORITY[\"EPSG\",\"9807\"]],PARAMETER[\"central_meridian\",
>> > 18.0],PARAMETER[\"latitude_of_origin\", 0.0],PARAMETER[\"scale_factor\",
>> > 1.0]\
>> > ,PARAMETER[\"false_easting\", 150000.0],PARAMETER[\"false_northing\",
>> > 0.0],UNIT[\"m\", 1.0],AXIS[\"Northing\", NORTH],AXIS[\"Easting\",
>> > EAST],AUTHORITY[\"EPSG\",\"3011\"]]" ;
>> >         float time(time) ;
>> >                 time:standard_name = "time" ;
>> >                 time:long_name = "time" ;
>> >                 time:bounds = "time_bnds" ;
>> >    time:units = "hours since 2006-01-01 00:00" ;
>> >                 time:calendar = "standard" ;
>> >                 time:axis = "T" ;
>> >         double time_bnds(time, bnds) ;
>> >         float crun(time, y, x) ;
>> >                 crun:long_name = "runoff" ;
>> >                 crun:units = "mm h-1" ;
>> >                 crun:grid_mapping = "projection" ;
>> >                 crun:coordinates = "lat lon" ;
>> >                 crun:_FillValue = -1.e+20f ;
>> >                 crun:missing_value = -1.e+20f ;
>> >                 crun:ModelAttributes = "{\'Hydrological Model\':
>> \'HYPE\'}"
>> > ;
>> >                 crun:DataAttributes = "{\"ECV\": \"monthly mean\",
>> > \"ECV_calculated_on\": \"2017-10-25\"}" ;
>> >
>> > // global attributes:
>> >                 :history = "Wed Oct 25 16:19:58 2017: cdo monmean
>> > timeseries/stockholm_110_presclim_crun.nc
>> > ecvs/stockholm_110_presclim_crun-monthly_mean.nc\nThu Jun 29 12:33:05
>> 2017:
>> > ncks -4 /data/proj/UrbanSI\
>> > S/workspace/JR/hype2grid/Stockholm/Harmonie/timeCRUN.nc
>> >
>> /data/proj/UrbanSIS/workspace/JR/hype2grid/Stockholm/Harmonie/publish/timeCRUN.nc\nThu
>> > Jun 29 12:32:44 2017: ncrcat /data/proj/UrbanSIS/workspace/JR/hype2\
>> > grid/Stockholm/Harmonie/timeCRUN-2006-2007_original_resampled.nc
>> >
>> /data/proj/UrbanSIS/workspace/JR/hype2grid/Stockholm/Harmonie/timeCRUN-2012-2014_
>> original_resampled.nc
>> > /data/proj/UrbanSIS/workspace/JR/hype2grid\
>> > /Stockholm/Harmonie/timeCRUN.nc" ;
>> >                 :Conventions = "CF-1.6" ;
>> >                 :contact1 = "Lena Stromback, SMHI,
>> lena.stromb...@smhi.se"
>> > ;
>> >                 :Originating_center = "Swedish Meteorological and
>> > Hydrological Institute (SMHI)" ;
>> >                 :Downscaling_model = "S-HYPE2012_version_4_0_0 adapted
>> for
>> > Urban SIS" ;
>> >                 :Downscaling_projection = "SWEREF-99 1800" ;
>> >                 :Downscaled_area = "Watershed based on Urban Atlas" ;
>> >                 :Forcing_boundary_conditions = "Urban SIS Harmonie
>> Stockholm
>> > historic" ;
>> >                 :Topography_routing = "SVAR
>> > http://www.smhi.se/publikationer/svar-svenskt-vattenarkiv-1.17833"; ;
>> >                 :Land_use = "Urban Atlas 2012
>> > http://land.copernicus.eu/local/urban-atlas/urban-atlas-2012, CORINE
>> Land
>> > COVER 2000
>> >
>> http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2000-clc2000-seam\
>> > less-vector-database" ;
>> >                 :Soil_type = "SGU http://www.sgu.se/"; ;
>> >                 :Lake_information = "SVAR
>> > http://www.smhi.se/publikationer/svar-svenskt-vattenarkiv-1.17833"; ;
>> >                 :nco_openmp_thread_number = 1 ;
>> >                 :NCO = "4.4.4" ;
>> >                 :frequency = "mon" ;
>> > data:
>> >
>> > ...
>> >
>> >
>> > Kind regards,
>> >
>> > Frank van der Stelt
>> > Systems developer
>> > SMHI - Swedish Meteorological and Hydrological Institute
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>> _______________________________________________
>> 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.
>


-- 
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

Reply via email to