简体   繁体   中英

netCDF files has no variables in python when importing with xarray

I'm VERY new to xarray, and I tried to import a satellite netcdf files into python using xarray using this file: https://tropomi.gesdisc.eosdis.nasa.gov/data//S5P_TROPOMI_Level2/S5P_L2__NO2____HiR.1/2020/003/S5P_OFFL_L2__NO2____20200103T170946_20200103T185116_11525_01_010302_20200105T100506.nc

This is the code I used:

import xarray as xr
import numpy as np
import pandas as pd

tropomi = xr.open_dataset('test2.nc', engine = 'netcdf4')
tropomi 

Output: 在此处输入图像描述

But the output does not present any variables, and has 53 attributes - why is this happening?

Thanks!

I figured it out. When you open the file without a group defined, you get the global attributes with no variables. You need to include a group='PRODUCT' to get the data products, like this:


tropomi = xr.open_dataset('test2.nc', group='PRODUCT')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM