Page 1 of 1

Accessing and Processing L3 Data in Python with netCDF4

Posted: Thu Oct 19, 2023 1:40 pm America/New_York
by eric.r.enloe
I am very new to netCDF4 and ocean color data in general, but I am having trouble simply viewing L3 data from MODIS using netCDF4 in python. I am specifically trying to view the RRS data over the whole available spectrum. What part of the dataset are the rrs data stored, group, attribute, variable, and how do you navigate to that part of the dataset to convert the data into a numpy array?

Re: Accessing and Processing L3 Data in Python with netCDF4

Posted: Mon Oct 30, 2023 4:20 pm America/New_York
by OB General Science - guoqingw
Hello,

We are working on sample python scripts for such purposes. These scripts will be available very soon, but here is an example to get you started:
L3 data is stored as variables, and you can use xarray to read them:

Code: Select all

import xarray as xr     

# use the following file as an example
filename = 'AQUA_MODIS.20201001_20201031.L3m.MO.RRS.Rrs_412.4km.nc'
# Load attributes
ds = xr.open_dataset(filename)

# read Rrs, latitude, and longitude data 
lat = ds.Rrs_412.lat
lon = ds.Rrs_412.lon
Rrs_412 = ds.Rrs_412.values

Re: Accessing and Processing L3 Data in Python with netCDF4

Posted: Fri Nov 03, 2023 10:46 am America/New_York
by hyoklee
Hi, @eric.r.enloe!

HTIC (HDF-EOS Tools & Information Center) added a new Python example today:

http://hdfeos.org/zoo/OBPG/AQUA_MODIS.20221001_20221031.L3m.MO.RRS.Rrs_412.4km.nc.py

I hope it helps your research!