Page 1 of 1
Opening downloaded .nc files
Posted: Tue Jul 30, 2024 7:19 pm America/New_York
by shrinidhin9
I'm currently (7/30/2024 16:00:00 PST) trying to download both normal and subsetted TEMPO NO2 L3 data from EarthData search, and I'm downloading the files straight from the database. I'm opening the files in python using xarray in VScode in python, and the only variables that come up are weight and latitude and longitude. I don't know what I'm doing wrong and downloading by script isn't working either. Is there an extra step I'm supposed to do when downloading files straight from EarthData Search? I tried using Harmony to subset the data with the variables I want and those still do not show up properly when I open the file using xarray. Any help in getting these files to work would be appreciated!
Re: Opening downloaded .nc files
Posted: Wed Jul 31, 2024 12:34 pm America/New_York
by ASDC - cheyenne.e.land
Hello,
We have contacted a Subject Matter Expert for TEMPO and they have stated that since TEMPO files are netCDF4 with groups, you need to specify the
group= parameter for the xr.open_dataset() function when wanting to access variables outside of the root group.
Thanks,
ASDC
Re: Opening downloaded .nc files
Posted: Thu Aug 08, 2024 11:09 am America/New_York
by shrinidhin9
When I tried to use group = "parameter" it gave me the error "OSError: [Errno group not found: parameter] 'parameter'", but I found from a different source that specifying group = "product" helped me access the data. Maybe it had to do with my machine being a Mac, but unsure. Thank you for your reply!
Re: Opening downloaded .nc files
Posted: Thu Aug 08, 2024 12:42 pm America/New_York
by ASDC - cheyenne.e.land
Hello,
Apologies if there was any confusion, but I did not mean to say that group = "parameter". I meant to say that because netCDF organizes its variables, dimensions, and attributes in hierarchical groups, you can open it using xarray if you know the specific groups/path and use
'group =' .
Example:
Code: Select all
import xarray as xr
fn = 'TEMPO_NO2_L3_V03_20240808T005451Z_S018.nc'
product_dataset = xr.open_dataset(fn, group='product')
Glad you figured it out.
Thanks,
ASDC