Accessing and Processing L3 Data in Python with netCDF4

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
eric.r.enloe
Posts: 6
Joined: Thu Oct 19, 2023 1:28 pm America/New_York
Answers: 0

Accessing and Processing L3 Data in Python with netCDF4

by eric.r.enloe » Thu Oct 19, 2023 1:40 pm America/New_York

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?

Tags:

OB General Science - guoqingw
Subject Matter Expert
Subject Matter Expert
Posts: 79
Joined: Fri Jun 03, 2022 10:54 am America/New_York
Answers: 0
Location: NASA GSFC
Been thanked: 1 time
Contact:

Re: Accessing and Processing L3 Data in Python with netCDF4

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

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

hyoklee
Posts: 7
Joined: Fri Mar 20, 2020 9:24 pm America/New_York
Answers: 0

Re: Accessing and Processing L3 Data in Python with netCDF4

by hyoklee » Fri Nov 03, 2023 10:46 am America/New_York

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!
Attachments
AQUA_MODIS.20221001_20221031.L3m.MO.RRS.Rrs_412.4km.nc.py.png
AQUA_MODIS.20221001_20221031.L3m.MO.RRS.Rrs_412.4km.nc.py.png (171.44 KiB) Not viewed yet

Post Reply