How to plot data from a NetCDF file

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

КОМЕНТАРІ • 10

  • @vinayk7
    @vinayk7 13 днів тому +1

    What an incredible and helpful tutorial thanks a lot! Only thing I am wondering is how can I plot only a sub-area like for example I provide 2 pairs of latitude and longitude that define a rectangular region and just plot that region only

    • @LukeDataManager
      @LukeDataManager  11 днів тому +1

      Thanks, something like this
      ax.set_extent([-30, 60, 30, 75], crs=ccrs.PlateCarree()) # Longitude and latitude

  • @anishratnashakya3964
    @anishratnashakya3964 5 місяців тому

    The link for global surface temperature is giving an error. Is there a way to download as nc file rather than using URL?

    • @LukeDataManager
      @LukeDataManager  5 місяців тому

      Seems to me that NOAA are having some issue with their THREDDS server right now. Try here:
      www.ncei.noaa.gov/data/noaa-global-surface-temperature/v6/access/gridded/
      And you should be able to download v6 of the data in a NetCDF file

    • @anishratnashakya3964
      @anishratnashakya3964 5 місяців тому

      @@LukeDataManager When I reach this part
      '''
      desired_date = '2022-12-01'
      data_for_desired_date = xrds.sel(time=desired_date)
      print(data_for_desired_date)
      '''
      It gives TypeError: get_loc() got an unexpected keyword argument 'method'
      Did I miss to import some libraries?

    • @anishratnashakya3964
      @anishratnashakya3964 5 місяців тому

      It worked in Colab. I might have missed something in local device.

  • @RohanAnand-fy5ic
    @RohanAnand-fy5ic 6 місяців тому

    hey, what is pressure and depth there, is it a dtype or what?

    • @LukeDataManager
      @LukeDataManager  6 місяців тому +1

      I am not entirely sure what you mean, and pressure is not provided in either of the datasets.
      When looking at the variables, you might see for example
      CHLOROPHYLL_A_TOTAL (DEPTH) float64 ....
      In this example, CHLOROPHYLL_A_TOTAL is the variable name, DEPTH is the name of the dimension, and float64 is the format of the values in the variable.

    • @RohanAnand-fy5ic
      @RohanAnand-fy5ic 6 місяців тому +1

      @@LukeDataManager ohh..yes I was talking about (DEPTH), and I got it now that the data within the file is organized and indexed along this dimension. Thanks!

    • @LukeDataManager
      @LukeDataManager  6 місяців тому +1

      Glad you solved it!