How to plot data from a NetCDF file (NetCDF in Python #02)
HTML-код
- Опубликовано: 13 июл 2024
- In this video, you will learn to quickly and easily make plots of data from a NetCDF file in Python
Chapters
00:00 Introduction
00:12 Installing and importing modules
00:50 1st dataset (1D depth profile)
09:08 2nd dataset (Map)
How to cite this video
If you think this course contributed to the work you are doing, consider citing it in your list of references. Here is a recommended citation:
Marsden, L. (2024, April 19). NetCDF in Python - from beginner to pro. Zenodo. doi.org/10.5281/zenodo.10997447
All videos in this course:
01: • How to open a NetCDF f...
02: • How to plot data from ...
03: • How to write data from...
04: • How to create a NetCDF...
05: • How to structure a dat...
06: • How batch create NetCD...
07: • How to extract data fr...
The code
This tutorial series is accompanied by a Jupyter Book with code, explanations and more examples. You can find the relevant section here:
lhmarsden.github.io/NetCDF_in...
Data used in this tutorial:
Anna Vader, Lucie Goraguer, Luke Marsden (2022) Chlorophyll A and phaeopigments Nansen Legacy cruise 2021708 station P4 (NLEG11) 2021-07-18T08:50:42 doi.org/10.21335/NMDC-1248407...)
OPeNDAP link: opendap1.nodc.no/opendap/chem...
H.-M. Zhang, B. Huang, J. H. Lawrimore, M. J. Menne, and T. M. Smith (2019): NOAA Global Surface Temperature Dataset (NOAAGlobalTemp), Version 5.0. NOAA National Centers for Environmental Information. doi:10.25921/9qth-2p70 Accessed 2024-01-04.
OPeNDAP link: www.ncei.noaa.gov/thredds/dod...
www.ncei.noaa.gov/access/meta...
hey, what is pressure and depth there, is it a dtype or what?
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.
@@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!
Glad you solved it!
The link for global surface temperature is giving an error. Is there a way to download as nc file rather than using URL?
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
@@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?
It worked in Colab. I might have missed something in local device.