Это видео недоступно.
Сожалеем об этом.
How to open a NetCDF file (NetCDF in Python #01)
HTML-код
- Опубликовано: 13 авг 2024
- In this video, we will open a NetCDF file in Python, understand what is inside, and learn to read the data and metadata.
Chapters
00:00 Introduction to the course
02:11 Installing and importing modules
03:41 Opening a NetCDF file with xarray
04:35 Introducing OPeNDAP
05:31 Understanding the contents of a NetCDF file
07:20 Global attributes (metadata describing the whole file)
09:47 Attribute Convention for Data Discovery (ACDD)
10:34 The Climate & Forecast Conventions (CF)
11:44 Dimensions
12:24 Coordinate variables
12:52 Data variables
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:
Elizabeth Jones (2022) CTD data from Nansen Legacy Cruise - Joint cruise 2-1 Station: P1_NLEG01-1 doi.org/10.21335/NMDC-2085836...
OPeNDAP link: opendap1.nodc.no/opendap/phys...
Useful links
Climate and Forecast (CF) conventions: cfconventions.org/
CF standard names: cfconventions.org/Data/cf-sta...
Attribute Convention for Data Discovery: wiki.esipfed.org/Attribute_Co...
NetCDF compliance checker: compliance.ioos.us/index.html
Photo of me in thumbnail taken by Kathrine Lindsay
Loved it! :)
Thanks!
Hi Luke, how are you dude? Excuse me, I'm trying to see a .nc from Modis Aqua satellite for to get the chlorophyll concentration with Python, I'm follow your steps but the file doesn't show the variables, it's empty. Do you have some video about this situation?
Very unusual. Where can I find the data?
@@LukeDataManager You can download from ocean color web site, is a NASA page, this is the link where you can get a .nc file : oceancolor.gsfc.nasa.gov/cgi/browse.pl?sen=amod
or if you want a can send you a email with the file attached
Amazing video. Thank you!
How do I fix this problem: AttributeError: partially initialized module 'xarray' has no attribute 'open_dataset' (most likely due to a circular import)?
You can fix the `AttributeError` by following these steps:
1. **Check for Circular Imports**: Ensure there are no circular dependencies in your imports.
2. **Correct Import Statement**:
```python
import xarray as xr
dataset = xr.open_dataset('your_dataset_file.nc')
```
3. **Avoid Module Name Conflicts**: Ensure your script is not named `xarray.py` or similar.
4. **Verify Environment**: Make sure you are using the environment where xarray is installed.
Thanks for the video. But how to read separate nc file in the computer?
Do you mean if you have multiple files on your computer? Then you need to open them one by one in a for loop for example.
You might find this video useful: ruclips.net/video/AbLRV5YUW2g/видео.html
In it I extract data from multiple NetCDF files that are hosted on a THREDDS server. But you can adapt the code to loop through files on your computer instead of a THREDDS server.
Just use the relative or absolute filepath to your netcdf files instead of the OPeNDAP URL.
@@LukeDataManager Thank you. I will try
how do i fix the problem when it says no module ‘xarray’
'Pip install xarray' in your terminal