Coder Social home page Coder Social logo

Comments (8)

 avatar commented on June 13, 2024

Neither does GeoJSON input work.

from trefoil.

brendan-ward avatar brendan-ward commented on June 13, 2024

@ererkka unfortunately, it sounds like it is an issue with fiona (which we use to read shapefiles) not being able to read your shapefile.

Since fiona is a dependency to trefoil, you should be able to use the fiona CLI in the same python environment as you installed trefoil:
https://github.com/Toblerity/Fiona#fiona-cli

fio info --indent 2 gis/sweden.shp

May tell you a bit more directly if fiona is not able to read it.

If you have gdal installed on your computer, running gdalinfo gis/sweden.shp may also tell you about any potential errors in your shapefile. Note: fiona uses some of the gdal/ogr internals to read shapefiles, but through a different interface.

Lastly, what is the nature of gis/sweden.shp? Is it a polygon, line, point file? How was it created? Something about that pipeline may inform us as to the issue.

from trefoil.

 avatar commented on June 13, 2024

The shapefile consist of four polygons over Sweden, and they are in WGS84. From fio info I get:

{
  "name": "sweden",
  "bounds": [
    10.982554050000035,
    55.33685324592171,
    24.16659005000005,
    69.06008174803289
  ],
  "schema": {
    "properties": {
      "NUTS_ID": "str:80",
      "Clusters_c": "str:254",
      "country": "str:10"
    },
    "geometry": "Polygon"
  },
  "count": 4,
  "crs": "EPSG:4326",
  "driver": "ESRI Shapefile",
  "crs_wkt": "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.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"
}

from trefoil.

brendan-ward avatar brendan-ward commented on June 13, 2024

@ererkka I wonder if the . you have at the end of your command line call or the \ in your paths is throwing things off.

Would you mind trying this?

trefoil zones --attribute Clusters_c --like MERRA2_data/MERRA-2.tavg1_2d_lnd_Nx.20170101.SUB.nc4 gis/sweden.shp sweden_zones.nc

from trefoil.

 avatar commented on June 13, 2024

Same thing :(

It seems that the exception is raised by rasterio.rio.options.file_in_handler() (callback in file_in_arg) because rasterio.shutil.exists('gis/sweden.shp') returns False. I wonder why is trefoil using rasterio to check the file?

from trefoil.

brendan-ward avatar brendan-ward commented on June 13, 2024

@ererkka no idea why I was using rasterio for the shapefile, nor do I know how that ever worked. Very sorry for that issue and for the delays in getting it resolved!

I was able to reproduce your issue, then resolved in the fix list above. Please pull the latest from master on this repo, and try again. If the fix works for you, I'll then push up to pypi.

from trefoil.

 avatar commented on June 13, 2024

Now it works. Thank you very much!

from trefoil.

brendan-ward avatar brendan-ward commented on June 13, 2024

šŸŽ‰ thank you for reporting this issue, @ererkka

from trefoil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.