how to retrieve chlorophyll data from the downloaded files?

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
huyunyi
Posts: 5
Joined: Mon Oct 07, 2019 5:30 pm America/New_York
Answers: 0

how to retrieve chlorophyll data from the downloaded files?

by huyunyi » Tue Oct 08, 2019 10:48 am America/New_York

Hi,

I try using Python to retrieve chlorophyll data but I cannot itentify any variables after using netCDF4 package:

the code is:
from netCDF4 import Dataset
data = Dataset('filename.nc')
print(data.variables.keys())

then the variables are empty.

I also open the data file in SeaDAS and could see the chlorophyll data. so What should I do?

I appreciate your help!

Filters:

OB SeaDAS - dshea
Subject Matter Expert
Subject Matter Expert
Posts: 264
Joined: Thu Mar 05, 2009 10:25 am America/New_York
Answers: 0
Been thanked: 2 times

how to retrieve chlorophyll data from the downloaded files?

by OB SeaDAS - dshea » Tue Oct 08, 2019 10:59 am America/New_York

the variables are in the group "geophysical_data", so try this:

from netCDF4 import Dataset
data = Dataset('filename.nc')
print(data.groups['geophysical_data'].variables.keys())

don

huyunyi
Posts: 5
Joined: Mon Oct 07, 2019 5:30 pm America/New_York
Answers: 0

how to retrieve chlorophyll data from the downloaded files?

by huyunyi » Tue Oct 08, 2019 12:11 pm America/New_York

that works! now I can read the attributes of the variable chlorophyll.but how can get the values of the variable?

and there is another question: where is the latitude and longitude variables? I need to match the chlorophyll and the position.

thanks so much!

best,
yunyi

OB.DAAC - SeanBailey
User Services
User Services
Posts: 1485
Joined: Wed Sep 18, 2019 6:15 pm America/New_York
Answers: 1
Been thanked: 5 times

how to retrieve chlorophyll data from the downloaded files?

by OB.DAAC - SeanBailey » Tue Oct 08, 2019 12:17 pm America/New_York

Those would be in the navigation_data group:

print(data.groups.keys())
odict_keys(['sensor_band_parameters', 'scan_line_attributes', 'geophysical_data', 'navigation_data', 'processing_control'])

print(data['navigation_data'].variables.keys())
odict_keys(['longitude', 'latitude', 'cntl_pt_cols', 'cntl_pt_rows', 'tilt'])


Sean

huyunyi
Posts: 5
Joined: Mon Oct 07, 2019 5:30 pm America/New_York
Answers: 0

how to retrieve chlorophyll data from the downloaded files?

by huyunyi » Tue Oct 08, 2019 12:30 pm America/New_York

Hi Sean,

I found them. Thanks so much for your help!

Best,
Yunyi

huyunyi
Posts: 5
Joined: Mon Oct 07, 2019 5:30 pm America/New_York
Answers: 0

how to retrieve chlorophyll data from the downloaded files?

by huyunyi » Tue Oct 08, 2019 4:53 pm America/New_York

Hi Sean,

I notice the variable latitude is a matrix with 922 rows and 265 columns. but I don't find the rules behind the values.

for example,
print(latitude)
[[17.824507 17.822117 17.81972  ... 16.696947 16.688335 16.679647]
[17.83543  17.833052 17.830666 ... 16.714483 16.705923 16.697289]
[17.82531  17.822823 17.820326 ... 16.64324  16.634192 16.625063]
...
[25.942488 25.939787 25.937078 ... 24.631378 24.621128 24.610785]
[25.953365 25.950676 25.947979 ... 24.64875  24.638552 24.628262]
[25.964241 25.961565 25.958881 ... 24.66612  24.655975 24.645737]]

It seems there are overlapped ranges between rows and columns. could you explain how the structure is formed?

Thanks!

Yunyi

OB.DAAC - SeanBailey
User Services
User Services
Posts: 1485
Joined: Wed Sep 18, 2019 6:15 pm America/New_York
Answers: 1
Been thanked: 5 times

how to retrieve chlorophyll data from the downloaded files?

by OB.DAAC - SeanBailey » Tue Oct 08, 2019 6:52 pm America/New_York

The navigation array should be a pixel for pixel match for the geophysical data array unless the data were processed with a control point increment different than 1 (something we have not done in a LONG time - long before we started writing the data in netCDF).

The locations defined in the latitude and longitude arrays are the geolocated position for the data.
Level 1 and 2 data are not mapped, so in the case of MODIS and VIIRS there will be a "bow-tie" effect
at the edge of the scan.

Sean

Post Reply