Page 1 of 1

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 10:48 am America/New_York
by huyunyi
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!

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 10:59 am America/New_York
by OB SeaDAS - dshea
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

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 12:11 pm America/New_York
by huyunyi
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

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 12:17 pm America/New_York
by OB.DAAC-EDL - SeanBailey
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

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 12:30 pm America/New_York
by huyunyi
Hi Sean,

I found them. Thanks so much for your help!

Best,
Yunyi

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 4:53 pm America/New_York
by huyunyi
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

how to retrieve chlorophyll data from the downloaded files?

Posted: Tue Oct 08, 2019 6:52 pm America/New_York
by OB.DAAC-EDL - SeanBailey
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