Extracting subregions from netcdf files - this video makes the cut!

Поділитися
Вставка
  • Опубліковано 15 січ 2025

КОМЕНТАРІ • 64

  • @arjunkaushik5075
    @arjunkaushik5075 3 роки тому +6

    I seriously have no words for this video. I seriously want to thank you in person for such great help. I was struggling for a long. God bless you, dear.

  • @Oceansteve
    @Oceansteve 3 роки тому +1

    As others say, much gratitude for the tutorial.

    • @climateunboxed
      @climateunboxed  3 роки тому

      My pleasure. The nearest neighbor interpolation trick to extract a single grid point is really nice no?

    • @Oceansteve
      @Oceansteve 3 роки тому

      @@climateunboxed it’s near essential. It’s been quite interesting extracting on the command line. Hope you do more videos!

    • @climateunboxed
      @climateunboxed  3 роки тому

      @@Oceansteve more in the pipeline at editing stage. I'm slow, this is a side hobby fighting for time with family and house renovations 🤣😉

  • @АнастасияТимофеева-х1р

    Thank you very much for such a great job. This playlist is extremely helpful for me as for student

    • @climateunboxed
      @climateunboxed  3 роки тому

      You are very welcome, glad you find it helpful. More material slowly on its way... Don't forget to subscribe so you will get notifications when new material sporadically appears....

  • @MyIndia2100
    @MyIndia2100 2 роки тому +3

    Sir, How to extract a dedicated region suppose a catchment region?

  • @brunodepaulak
    @brunodepaulak 2 роки тому +1

    Neat! Thanks!

  • @shunrei1974
    @shunrei1974 2 роки тому +1

    I tried to reproduce your example but it says 'command not found: cdo -sellonlatbox'. Do you know why?

    • @climateunboxed
      @climateunboxed  2 роки тому

      are you on ubuntu? You probably need to install it. Try sudo apt install cdo ... on a mac I use homebrew, thus brew install cdo

  • @KNOgbu
    @KNOgbu 2 роки тому +1

    MANY THANKS

  • @silverreserve5174
    @silverreserve5174 2 роки тому +1

    Thanks Is there a command to statistically downscaled the NetCDF

    • @climateunboxed
      @climateunboxed  2 роки тому

      Not a single command but you can construct a lapse rate downscaling using a combination of the commands i show. I may try to find time to have a separate video on that as it will feature in my new edX course

    • @silverreserve5174
      @silverreserve5174 2 роки тому

      @@climateunboxed Thanks

  • @Leksa135
    @Leksa135 3 роки тому +1

    I tried it and it worked quite well. Only question I have is that why the output area is not strictly limited by the longitudes and latitudes I gave, but is clearly larger? I am dealing with Lambert conformal projection, if that matters.

    • @climateunboxed
      @climateunboxed  3 роки тому

      It shouldn't be the case. What is the exact command you tried?

    • @Leksa135
      @Leksa135 3 роки тому

      @@climateunboxed The command I used: "cdo sellonlatbox,19.5,31.7,59.7,70.2 original.nc output.nc"
      In the output file, I have longitudes from 16.51 to 40.67 latitudes from 58.34 to 71.16. The spatial resolution is approximately 0.03 degrees. The result is good enough for my use, but I'm just confused.

    • @climateunboxed
      @climateunboxed  3 роки тому

      @@Leksa135 I haven't worked with this projection before, but have you tried regridding to a regular lat-lon grid first? Something like "cdo -L sellonlatbox,19.5,31.7,59.7,70.2 -remapbil,global_0.1 in.nc out.nc" ?

    • @Leksa135
      @Leksa135 3 роки тому +1

      ​@@climateunboxed I tried it now, and some interesting things happened. First, the new area is now exactly what I wanted it to be. Second, the file size is much smaller now. The new output file is is like 10 % of the first output file I got (might be partly because lat/lon data type is now "linear" instead of "Geo2d").
      But unfortunately there seems to be some issues with the conservation of data. In the remapped file, the target grid cells have very different looking data when compared to the output file without remapping. The data is 1h precipitation, and I read that bilinear remapping might not be suitable for that kind of data. Or I'm doing something wrong. There might be some remapping methods that would work, but I'm not sure if I have the time to go very deep into that.
      But anyways, just extracting a subregion without remapping worked well enough and is very useful. Thank you for you help.

    • @climateunboxed
      @climateunboxed  3 роки тому

      @@Leksa135 yes it was just a test. Better to use "remapcon" for rain. It also depends on the resolution change. I strongly recommend checking out my video on remapping. Please subscribe if you find the material useful and pass the word. 😊

  • @hajarelhlaissi914
    @hajarelhlaissi914 2 роки тому +2

    Thank you sir for the precision but this site will not define my region. Do you have an idea to help me define the region of Africa?

    • @climateunboxed
      @climateunboxed  2 роки тому +1

      Sellonlatbox only cuts a rectangle... If you want to remove the sea points, you can refer to my video on a land sea mask... Removing the middle east countries from the lonlat box requires the use of shape files which is beyond the capabilities of CDO to my knowledge. For that you'd need to use R or python etc .

  • @theres_more
    @theres_more Рік тому +1

    Hi, thank you for posting this tutorial. I have cmip6 ocean data on a curvilinear grid (x, y coordinates). Let’s say I want to select the nino 3.4 region. Can I still select a box using latitude and longitude values?

    • @climateunboxed
      @climateunboxed  Рік тому

      Yes, in fact my very next video is on making an enso index. Will take a couple of weeks but will be out soon

  • @shunrei1974
    @shunrei1974 2 роки тому +1

    Thank you Sir for those very much needed video. Do you think of doing the same kind of teachings for R users?

    • @climateunboxed
      @climateunboxed  2 роки тому +1

      I'm afraid not, sorry. I tried R for a while before converting to python, I'm really not a fan... After I've finished my next few CDO videos though my next project is a series of videos on the physics of climate... 🙂

  • @johnyoung8848
    @johnyoung8848 2 місяці тому

    Is it possible to extract using a shapefile?

  • @davidragatoa7174
    @davidragatoa7174 2 роки тому +1

    That's a great one. Thank you Sir.
    How do I merge subsets if I want to bring spatial subsets together (same time steps and variables for the files) ?
    Thanks

    • @climateunboxed
      @climateunboxed  2 роки тому

      Thanks for the feedback. Not sure I fully understand the question. The time step and variables are the same. Does that mean the grids are different?

  • @anjaisadnya
    @anjaisadnya 6 місяців тому

    sir, i was wondering if we could modify the size of the map in display when we open ncview? i've been looking for how to do that, but no avail. is it maybe depends on the file?

  • @KNOgbu
    @KNOgbu 2 роки тому +1

    I enjoy your videos and I am currently using many of them to learn. Will you show us how to perform spatial statistics using two or more gridded rainfall datesets?

    • @climateunboxed
      @climateunboxed  2 роки тому

      Thanks for your nice comments. What exactly did you have in mind for the request though? Can you be a bit more specific?

    • @somtoonyechi5925
      @somtoonyechi5925 2 роки тому

      @@climateunboxed for example, comparison of CMIP5 (e.g. rainfall) against CHIRPS or GPCC datasets

  • @cengizhancengiz1919
    @cengizhancengiz1919 Рік тому

    if ncdump is not available for us, could we modify the code before running to request data?

  • @MultiRose86
    @MultiRose86 2 роки тому

    Thanks for a nice video. Which program is this please and can we do this for a multiple NetCDf files please

    • @climateunboxed
      @climateunboxed  2 роки тому

      cdo, climate data operators... from the command line in linux - and yes you can use with multiple files in a loop or with wildcards

    • @MultiRose86
      @MultiRose86 2 роки тому

      @@climateunboxed Thanks I have a windows laptop, can I install CDO please. any video on this please I am struggling on this

    • @climateunboxed
      @climateunboxed  2 роки тому

      @@MultiRose86 the easiest thing is to install the linux subsystem - just a couple of clicks... once you have that you can install cdo with "sudo apt install cdo"

  • @rachalaishram9699
    @rachalaishram9699 2 роки тому +1

    this channel is such a treasure for budding climate researchers such as myself. sir i would like to know one thing , though, how to extract region based on the shapefile of a region in cdo? or if not possible what is the work around way for cropping a netcdf data using shapefile? thank you sir

    • @climateunboxed
      @climateunboxed  Рік тому

      Unfortunately you will need to do this in python or R...

  • @isratjahan207
    @isratjahan207 Рік тому

    Hi, I am trying to extract a subregion using the cdo sel lonlatbox command but a new dimension south_north_2 gets created in the output file. In the output file, south_north=309, and also south_north_2=308 gets created. Why is this happening? and how to get rid of this?

  • @manacebationo8565
    @manacebationo8565 2 роки тому +1

    Thanks for your helpful tutorial. Pls, How can I extract data from a netCDF file for a specific location? Thanks...

    • @climateunboxed
      @climateunboxed  2 роки тому

      Thanks. I have a video specifically on that topic called "extracting a location, do you get the point?" It should be linked in the playlist on my channel... Hope it helps

  • @geosciences5097
    @geosciences5097 11 місяців тому

    Thanks, why, when I use ncview infile.nc, I don’t have the graph, i working on the server

  • @nurulain1082
    @nurulain1082 2 роки тому +1

    Hi. Thank you for the sharing. It is what I am looking for, ncdump -v,latitude file.nc. But, can I extract the latitude as a new nc file? Thank you in advance!

    • @climateunboxed
      @climateunboxed  2 роки тому

      Not sure what you mean? Latitude is a dimension, but the values are stored in the file as a variable that you can read in to R python fortran etc just as any other variable.

  • @kuttiyash
    @kuttiyash 8 місяців тому

    I have more than 500 files. how to use all files to crop the region? instead of selecting one by one.

  • @Leksa135
    @Leksa135 3 роки тому +1

    Thanks a lot. I have been having trouble with too large nc-files.

    • @climateunboxed
      @climateunboxed  2 роки тому

      What is the issue? You mean for the download?

  • @alorsan2012
    @alorsan2012 Рік тому

    Hello, Could you show us how to use "cdo selregions", please? Thanks for a lot !!

  • @kingnnaemeka2231
    @kingnnaemeka2231 3 роки тому

    Thank you for this video. How can you cut out a region using a polygon shapefile?

    • @climateunboxed
      @climateunboxed  3 роки тому

      Unfortunately that's beyond the scope of CDO and needs python or R. I may put in a video on that later but I need to finish some CDO based material first for my online course in April

    • @rohitgautam5310
      @rohitgautam5310 3 роки тому +1

      @@climateunboxed what type of online course is it? Can we also participate? From India

    • @climateunboxed
      @climateunboxed  2 роки тому

      @@rohitgautam5310 it is an edX courses I'm putting together using these videos that will hopefully run this spring with UNESCO certification for those completing the units. More details to follow soon. It will be open to all. There will also be interactive sessions organized in gather for those signing up. As i say, as soon as I can i will post more details.

  • @arjunkaushik5075
    @arjunkaushik5075 3 роки тому

    Is there a way to change the units of rainfall variable in a NetCDF file from mm/day to mm? Similarly, temperature Kelvin to Celcius

    • @climateunboxed
      @climateunboxed  3 роки тому +1

      Temperature from k to c is cdo subc,273.15 in out . I'm just editing a video on this now to upload. The metadata still needs editing with NCO though. That's a video on my to-do list

    • @arjunkaushik5075
      @arjunkaushik5075 3 роки тому

      @@climateunboxed I will wait for the video.

  • @zarrinz1865
    @zarrinz1865 3 роки тому

    Thank you a million for your video, it is very useful for me to do the data preprocessing, I appreciate it very much. However, when I run this code in the terminal, I came across a problem, which always shows "Too many streams specified! Operator sellonlatbox needs 1 input stream and 1 output stream!". In fact, What I want to do is extracting NorthAmerica data between 1960 and 2014 from the CMIP6 model (which is a global dataset, and the time series is from 1850 to 2014). Can you please kindly help me out?

    • @climateunboxed
      @climateunboxed  3 роки тому

      It sounds like you are inserting spaces between sellonlatbox and the comma or the options... As I warn in the video it is important that sellonlatbox,lon1,lon2,lat1,lat2 is all together with no spaces, then you need one input file and one output file name - I hope that helps! Thanks for your kind words, some more videos on other aspects of processing will be appearing soon....

    • @zarrinz1865
      @zarrinz1865 3 роки тому

      @@climateunboxed Thanks for your kind reply. It works now. But I come across another problem, I'd like to extract a subregion time series for 1960 to 2014 from an original global dataset whose time series is between 1850 to 2014. My code is "cdo -sellonlatbox,-170,-55,7,72 -selyear,1960/2014 infile.nc outfile.nc", but an error shows that: segmentation fault cdo -sellonlatbox,-170,-55,7,72 -selyear,1960/2014 outfile.nc. So I'd like to ask whether this command is suitable for a continuous-time series extracting? Or what I should notice in it? Sorry for disturbing you again, since I'm a newbie to start CDO. Thanks for your time and help.

    • @climateunboxed
      @climateunboxed  3 роки тому

      @@zarrinz1865 Try using the option -L (i.e. cdo -L -sellonlatbox etc) f you get a core error or seg fault when piping, it forces sequential I/O access... I'll put a video on temporal stats soon, hopefully this week, but your comment reminds me that I should put out on piping too, thanks :-)