Calculating Zonal Statistics of a Raster using Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ม.ค. 2025

ความคิดเห็น • 56

  • @olssonfilip
    @olssonfilip 4 ปีที่แล้ว +11

    Just wanted to thank you for these vids, wish I had them during my time at Uni but now as a GIS professional I’m feeling even more inspired by your work! Looking forward to the next one : )

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว

      Glad you like them!

    • @kaustavdas5600
      @kaustavdas5600 ปีที่แล้ว

      @geodeltalabs: In the same code, if I want to extract the 95th percentile value, what modification in the code do I need to do ?

  • @muhammadanjum524
    @muhammadanjum524 4 ปีที่แล้ว +1

    Dear Sir , Thank you soooooooooooooo much . You are sooo nice and kind . You are sooo expert in GIS . I hope you will continue your help .Its really very very helpful for me . I actually want to do that one . Sir, you solved my problem . Once again THANK YOU soo much .

  • @moisengwa9904
    @moisengwa9904 4 ปีที่แล้ว

    Very Good job GeoDelta Labs. I don't have enough words to thank you. Please please kindly post the part 2 tutorial Calculating Zonal Statistics of a Raster using Python. Looking forward to that:

  • @mulugetaworkuayele6412
    @mulugetaworkuayele6412 2 ปีที่แล้ว

    I am too late to learn from this interesting and very useful tutorial. Thank you so much!

    • @geodeltalabs
      @geodeltalabs  2 ปีที่แล้ว +1

      Better late than never :)

  • @abramswee
    @abramswee ปีที่แล้ว

    Thank you very much for sharing this with us! much appreciated.

  • @amitblizer4567
    @amitblizer4567 2 ปีที่แล้ว

    Thank you. This was very helpful for me in my thesis🙏

  • @shaileshshrestha9725
    @shaileshshrestha9725 4 ปีที่แล้ว +1

    good job bro...more geopandas pls.. one thing you have a good voice

  • @jeffz7310
    @jeffz7310 2 ปีที่แล้ว

    I didn't need to go to Uni because of these videos, thx

  • @gmjakirullahnooruddin1734
    @gmjakirullahnooruddin1734 4 ปีที่แล้ว +1

    Dear @GeoDelta Labs,
    Thanks for this great tutorial. Very much appreciable. Waiting for part two with multiple raster data.
    I have a couple questions. Do I have to project both my vector and raster dataset? If so how could I project multiple raster datasets at once? and the second question is while plotting/showing the raster data how could I show also raster scale right-side on my raster plot? Thanks in advance.

  • @kaustavdas5600
    @kaustavdas5600 ปีที่แล้ว

    Thanks a lot for this! ...just one question, if I want to extract the 95th percentile at any of the districts, wherever the raster is present. What modification in the code do I need to do. Anyone's help is really appreciated

  • @manuvideos3979
    @manuvideos3979 2 ปีที่แล้ว

    Hello, Thanks for this great tutorial. I have a question, while calculating the average, are taking in account the nodata pixels?
    If yes, is there a way to exclude nodata pixels while calculating average?
    Thanks in advance for your answer.

  • @rafaeltiara9092
    @rafaeltiara9092 4 ปีที่แล้ว

    Great tutorial. Thank you!

  • @DileepGuptagoodman
    @DileepGuptagoodman 3 ปีที่แล้ว

    Very nice video . I like sir . 👍👍👍

  • @yaarobmohammad1020
    @yaarobmohammad1020 4 ปีที่แล้ว +1

    You are the best

  • @raquelzafrir2752
    @raquelzafrir2752 4 ปีที่แล้ว

    Hi GeoDelta thanks for the video. I have a question. Did you check the values where your raster has no data or zero values? I am getting negative values and I do not know how to correct them.
    Thanks!

  • @australoitaliano
    @australoitaliano 4 ปีที่แล้ว

    @GeoDelta Labs, thank you very much for this fantastic tutorial. Just one question: how can I save the "mean" dataset in the shapefile?
    After I have performed the zonal statistic, I have open the shapefile with QGis but the "mean" column was not present in the attribute table. Thanks

    • @muhammadanjum524
      @muhammadanjum524 4 ปีที่แล้ว

      Dear Sir, I am also trying to use QGIs and also python , but I could not my results . Can we discuss Please ?

  • @umairrasool9580
    @umairrasool9580 4 ปีที่แล้ว

    Very great and clear work you have done. i have a question please, i am working on my raster dataset for prediction like ANN, RF and CNN, i have converted the rasters into numeric and then train and test the data and got very good accuracy. Now i need to convert my test data into raster again as final prediction map but i don't know how to do this, please guide me thanks.

  • @sonukumar-cy1fo
    @sonukumar-cy1fo 4 ปีที่แล้ว

    Sir, I got this error :MemoryError: Unable to allocate 21.4 TiB for an array with shape (2028294, 1449644) and data type float64. please help me

  • @mohammadbelalalzoubi8102
    @mohammadbelalalzoubi8102 3 ปีที่แล้ว

    Thank you. It was a great video.

  • @hugonicolaubarbosadegusmao7824
    @hugonicolaubarbosadegusmao7824 4 ปีที่แล้ว

    The tutorial was very good, I learned a lot! A question, where did you download this data? I wanted to download to Brazil.

  • @JesusRomero-zw8yw
    @JesusRomero-zw8yw 2 ปีที่แล้ว

    Thanks for the explanation, but if I want to extract the areal average of each day (that is, the average area of ​​a polygon) from a netcdf file, for example precipitation or temperature, maybe some idea

    • @geodeltalabs
      @geodeltalabs  2 ปีที่แล้ว

      Hi, for this I suggest you follow the tutorials that I have done on handling netcdf files using python. You might be able to modify the code in such a way that you would be able to extract the values into a separate set based on their geographical position, and perform the statistical operations on those extracted values.

  • @reshmaa8818
    @reshmaa8818 3 ปีที่แล้ว

    How to install rasterio and rasterstats?? Can you provide your video link below

  • @daanidev
    @daanidev 4 ปีที่แล้ว

    Hi,
    Can you please tell me how you prepare tif files?
    i have tif files and shape file but i am unable to map correctly just as you did in this video.
    Can you help me with it?
    Thanks

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว +1

      Hi, did you check whether both the raster and the vector files are having the same coordinate reference?

    • @daanidev
      @daanidev 4 ปีที่แล้ว

      @@geodeltalabs Hi my shape file and raster file has same crs can you please help me to show shape file over raster in python ?

    • @daanidev
      @daanidev 4 ปีที่แล้ว

      @@geodeltalabs thanks issue solved (Y)

  • @rajuahmmad9923
    @rajuahmmad9923 4 ปีที่แล้ว

    I have converted APHRODITE precipitation data from netcdf to tif file. After that, i followed your tutorial and calculated mean value for each subbasin within my watershed shapefile, But i got NaN value in three of my subbasin. Could you please point out what might be the possible cause of this problem. Thanks in advance.

    • @slimieboy6264
      @slimieboy6264 11 หลายเดือนก่อน

      having the same issue with a tif converted from a netcdf. idk what is wrong tbh

  • @DileepGuptagoodman
    @DileepGuptagoodman 3 ปีที่แล้ว

    Please make the video for mapping of CSV data in geotiff. CSV have lat lon and values

  • @yaarobmohammad1020
    @yaarobmohammad1020 4 ปีที่แล้ว +1

    Can you please make more videos
    How to extract and compute volumes from raster
    How to make hydrogeological analysis
    And so on

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว +1

      Hi, do you mean to just to do a one time computation of the volume from a raster? If you do not have a specific reason to use scripting to do that, I believe you can do this kind of processes quite easily using qgis

    • @yaarobmohammad1020
      @yaarobmohammad1020 4 ปีที่แล้ว

      GeoDelta Labs I think that coding always better than do it with software ; because u can use you’re code always with different situations and faster
      Thank you so much

  • @malaymondal9953
    @malaymondal9953 4 ปีที่แล้ว

    From which site we can get raster weather data, like wind speed, rainfall, temp etc.

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว +1

      You can try Aphrodite's portal for rainfall and temp in netCDF format. Windspeed, not so sure.

  • @sonalisharma3421
    @sonalisharma3421 2 ปีที่แล้ว

    Hello Sir, can you please tell me how to perform zonal statistics on each band of raster stack.
    Thank you very much for making such useful videos.

  • @jitutiwari7813
    @jitutiwari7813 3 ปีที่แล้ว +1

    Hi, first of all Thank you for this Tutorial. I am a GIS and remote Sensing student and also want to Learn python for geospatial task can you please suggest me how could i learn python. or which books or tutorial can help me. waiting for your response. and please can you tell me how to calculate zonal on bigTiff.

  • @andresfiallos7112
    @andresfiallos7112 4 ปีที่แล้ว

    Hello GeoDeltaLabs, thanks a lot for this great video. I have a question and was hoping someone here can help me. When I run this line "avg_rf = rasterstats.zonal_stats(districts, rainfall_array, affine = affine,
    stats = ['mean'], geojson_out = True)" I get the following error: "MemoryError: Unable to allocate 3.95 TiB for an array with shape (620193, 874319) and data type float64" I have been trying to resolve this issue but I havent been able to do so. I would really appreciate the help!

  • @shakhawathossainshohel5159
    @shakhawathossainshohel5159 4 ปีที่แล้ว

    Thanks a lot for the video, it was great. But I need to learn zonal statistics for multiple netcdf file like daily TRMM. Would you please help me?

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว

      Better try to convert to raster first.

  • @muhammadanjum524
    @muhammadanjum524 4 ปีที่แล้ว +1

    Dear Sir, this is really really an excellent video for zonal statistics . But I followed your method but could not get results . I need to discuss . Sir, Please help me .This is my very very humble request . Please . I need to discuss with you . Please let me know how and where can i discuss with you ? Please my most humble request . Please reply positively as soon as possible . Please

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว +1

      Hi, kindly send your query to our email. Thank you.

    • @muhammadanjum524
      @muhammadanjum524 4 ปีที่แล้ว

      @@geodeltalabs Sir, I have raster , I did calculate average monthly values by using QGIS raster calculator and now I want to calculate Zonal statistics . How can i send you my raster and shape file . Please help me . Sir, its my humble request that how can i send you ? Please

  • @eddisonjose
    @eddisonjose 4 ปีที่แล้ว

    Hola muchas gracias, eso se puede hacer en pycharm? Soy neófito en programación, pero que opinas del programa pycharm? Saludos

    • @geodeltalabs
      @geodeltalabs  4 ปีที่แล้ว +1

      Hello Eddison, pycharm is a good IDE too, however I have always worked with Spyder IDE, as the interface is simple, but sufficient enough to get the job done. You can indeed use pycharm to do all what we are doing here

    • @eddisonjose
      @eddisonjose 4 ปีที่แล้ว

      @@geodeltalabs hola muchas gracias por su respuesta y amabilidad

    • @eddisonjose
      @eddisonjose 4 ปีที่แล้ว

      GeoDelta Labs Hola una pregunta mas: Que opinas de hacer estos procesos en jupyter notebook? es factible? se pueden hacer allí?🙂

  • @wonga_masiza
    @wonga_masiza 4 ปีที่แล้ว

    I wish I could do all this in R. ..I can't install some of these packages as I am not administrator. I have to log calls to our service desk every time I need to install a package.
    When I try installing them on my laptop I get errors that I must provide a path to GDAL.. Last time I had to use anything related to GDAL it gave me hell. Its easier to install all these packages in R... my goodness, I have to migrate to python once. I am going to die