qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.5k stars 2.99k forks source link

Broken rendering after Add Mesh Layer and Tools::TemporaryFile: Cannot create temporary file name.: unspecified iostream_category error #39724

Closed drf5n closed 3 years ago

drf5n commented 3 years ago

After attempting a Layer/Add Mesh Layer/ Choose Source: Mesh dataset {select file} and Add, an error window pops up containing Tools::TemporaryFile: Cannot create temporary file name.: unspecified iostream_category error, and afterwards the map window fails to update properly until QGIS is closed.

My sample Mesh data is available at https://drive.google.com/file/d/1jGWe03bfsM7bjr4n0iI-xPSe_SE0vG9Q/view?usp=sharing it is a 28MB 1-timestep subset of a 248MB file, and below is an ncdump of its header.

In QGIS 3.16 Mesh layers work as expected using the example file from https://github.com/lutraconsulting/MDAL/blob/master/tests/data/ugrid/ADCIRC/ADCIRC_BG_20190910_1t.nc

But when I try it on my own newly created data, I get a "Tools::TemporaryFile: Cannot create temporary file name.: unspecified iostream_category error" and QGIS doesn't seem to render or add any new layers.

Here is the sample data:

image

Here is the screenshot after Layer/Add Mesh Layer selecting the file in Mesh Dataset and pushing the Add button.

image

I'm not as concerned with getting the formatting and attributes right on my file as the fact that after this error, rendering and refreshing seems to break somehow. For example, I can zoom to my new layer's extents, and the window/bounding box/coordinates seem reasonable, but nothing shows. Raster files, OSG basemaps and all else. I can then uncheck the ADCIRC layer's visibility, zoom to its extents, and the same ADCIRC layer reappears (note the layer checkboxes in the third screen shot -- this mesh is disables and shouldn't be visible). The silent non-rendering-updating of the map view after accepting the error makes it difficult to troubleshoot my datafile, since no further errors occur.

image

At this point, if I leave my layer unchecked, I can save, quit, and reopen the project and it acts normally (I can add an OSM basemap, add a TIFF raster and zoom around, but if I check the layer the error returns and the updating of the windows stops (but you can pan and zoom the pre-error render. See the un-updated margin around this area--it should have more OSM basemap in it.

image

The behavior that I would expect is that if there is an error loading some sort of malformed file with 'Layer/Add Mesh Layer' or enabling a mesh layer, it would not break rendering, but hopefully fail gracefully and provide feedback on the way the file read failed.

$ ncdump -h elev_1frame.nc 
netcdf elev_1frame {
dimensions:
    nele = 1576125 ;
    nface = 3 ;
    time = UNLIMITED ; // (1 currently)
    node = 815103 ;
variables:
    int ele(nele, nface) ;
        ele:long_name = "Horizontal Triangular Element Table" ;
        ele:units = "non-dimensional" ;
        ele:cf_role = "face_node_connectivity" ;
        ele:start_index = 1 ;
    float elev(time, node) ;
        elev:long_name = "sea surface height" ;
        elev:mesh = "mesh" ;
        elev:location = "node" ;
        elev:units = "m" ;
        elev:standard_name = "sea_surface_height_above_geoid" ;
        elev:coordinates = "time lon lat" ;
    float lat(node) ;
        lat:units = "degrees_north" ;
        lat:standard_name = "latitude" ;
        lat:mesh = "mesh" ;
        lat:location = "node" ;
    float lon(node) ;
        lon:units = "degrees_east" ;
        lon:standard_name = "longitude" ;
        lon:mesh = "mesh" ;
        lon:location = "node" ;
    int mesh ;
        mesh:cf_role = "mesh_topology" ;
        mesh:long_name = "Topology data of 2d unstructured mesh" ;
        mesh:topology_dimension = 2 ;
        mesh:node_coordinates = "lon lat" ;
        mesh:face_node_connectivity = "ele" ;
        mesh:standard_name = "mesh topology" ;
    float time(time) ;
        time:long_name = "Time" ;
        time:units = "seconds since 2020-10-29 00:00:00+0000" ;
        time:base_date = "2020-10-29 00:00:00+0000                        " ;
        time:standard_name = "time" ;
...

QGIS and OS versions

QGIS version 3.16.0-Hannover QGIS code revision 4af1cbfb97
Compiled against Qt 5.14.2 Running against Qt 5.14.2
Compiled against GDAL/OGR 3.1.2 Running against GDAL/OGR 3.1.2
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version macOS Mojave (10.14)
Active python plugins VectorBender; quick_map_services; LAStools; latlontools; Qgis2threejs; gribdownloader; mmqgis; StreetView; timemanager; processing; db_manager; MetaSearch
drf5n commented 3 years ago

I see this particular "Tools::TemporaryFile: Cannot create temporary file name." error string in the libspatialindex library here:

https://github.com/libspatialindex/libspatialindex/blob/32ec7f99f960369b55d1eb333f2b02aab059330b/src/tools/Tools.cc#L1084

drf5n commented 3 years ago

Nevermind -- I figured out how to start a clean profile, (/Settings/User Profile -- easy-- I didn't have to move .qgis or whatever)

It seems to be some interaction with my default profile. I disabled all the plugins in my default profile, and then tested while re-enabling them (below), and I couldn't re-duplicate.

Wait -- if I have my new, fresh profile open, and open my old default simultaneously, with all its plugins on or off, I cannot duplicate the error, but it I start with only the old default profile by itself, all plugins on or off, I experience the same error.

This is too confusing, and isn't worth your time. Closing.

QGIS version 3.16.0-Hannover QGIS code revision 4af1cbfb97
Compiled against Qt 5.14.2 Running against Qt 5.14.2
Compiled against GDAL/OGR 3.1.2 Running against GDAL/OGR 3.1.2
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.31.1 Running against SQLite 3.31.1
PostgreSQL Client Version 12.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version macOS Mojave (10.14)
Active python plugins VectorBender; quick_map_services; LAStools; latlontools; Qgis2threejs; gribdownloader; mmqgis; StreetView; crayfish; timemanager; processing; db_manager; MetaSearch