Read and process cygnss L2 V2.1 NetCDF4 files

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
2120221999
Posts: 5
Joined: Sun Dec 29, 2024 1:01 pm America/New_York
Answers: 0

Read and process cygnss L2 V2.1 NetCDF4 files

by 2120221999 » Tue Feb 25, 2025 5:09 am America/New_York

I have a question for you, that is, about the processing of nc files, I downloaded the L2 level 2.1 version of CYGNSS data on podaac, the file name of this data is: cyg.ddmi.s20200101-000000-e20200101-235959.l2.wind-mss.a21.d21.nc, I used matlab2018b to read this file and get a struct, This struct shows mean_square_slope as a one-dimensional array (1598872×1double), I want to get the mean_square_slope data and its latitude and longitude, and this struct also has two variables, longitude and latitude, which are LON (1598872×1 Double) and lat (1598872× 1 Double), which are also 1D arrays, I want to know, mean_ square_slope variable's row index is a one-to-one correspondence with the latitude and longitude index, because I can't be sure of the latitude and longitude of the mean_square_slope. I would appreciate it if you could help me with this question. Details of mean_square_slope, longitude and latitude are as follows: mean_square_slope
Size: 1598872x1
Dimensions: sample
Datatype: single
Attributes:
long_name = 'Mean square slope'
coordinates = 'sample_time lat lon'
units = '1'
_FillValue = -9999
valid_range = [0 0.04]
comment = 'The average MSS of the 25 x 25 km cell centered on lat and lon, unitless.'

lat
Size: 1598872x1
Dimensions: sample
Datatype: single
Attributes:
long_name = 'Latitude'
standard_name = 'latitude'
units = 'degrees_north'
_FillValue = -9999
valid_range = [-60 60]
comment = 'The mean of the specular point latitudes of the DDMs that were utilized to derive wind_speed, degrees North.'

lon
Size: 1598872x1
Dimensions: sample
Datatype: single
Attributes:
long_name = 'Longitude'
standard_name = 'longitude'
units = 'degrees_east'
_FillValue = -9999
valid_range = [0 359.9999]
comment = 'The mean of the specular point longitudes of the DDMs that were utilized to derive wind_speed, degrees East.'

Filters:

PODAAC - scosic
User Services
User Services
Posts: 7
Joined: Thu May 27, 2021 2:52 pm America/New_York
Answers: 0

Re: Read and process cygnss L2 V2.1 NetCDF4 files

by PODAAC - scosic » Tue Mar 18, 2025 5:55 pm America/New_York

Thank you for your question. We are looking into this and will get back to you shortly.

PO.DAAC Team

PODAAC - jmcnelis
Subject Matter Expert
Subject Matter Expert
Posts: 23
Joined: Tue Mar 14, 2023 1:41 pm America/New_York
Answers: 0

Re: Read and process cygnss L2 V2.1 NetCDF4 files

by PODAAC - jmcnelis » Tue Mar 18, 2025 6:12 pm America/New_York

Hi, this is Jack from PODAAC.

Yes, lat/lon/time is not null for every valid observation. Pay attention to the valid_range and FillValue for each variable with the attribute defined. Apply the masks before using the data.

Here's a python snippet that shows how to read the netCDF variables into a tall table:

Code: Select all

>>> import netCDF4, pandas

>>> ds = netCDF4.Dataset("cyg.ddmi.s20200101-000000-e20200101-235959.l2.wind-mss.a21.d21.nc")

>>> pandas.DataFrame({i:ds.variables[i].__array__().data for i in ['sample_time', 'lon', 'lat', 'mean_square_slope']})
          sample_time         lon        lat  mean_square_slope
0        0.000000e+00  169.100281 -33.244186       -9999.000000
1        0.000000e+00  170.550964 -35.326721           0.005526
2        0.000000e+00  163.748001 -37.086918           0.019081
3        9.800000e-08   84.782585  18.327057           0.024955
4        9.800000e-08   77.260918   6.756299       -9999.000000
...               ...         ...        ...                ...
1598867  8.639950e+04  239.309525 -29.744408           0.024462
1598868  8.639950e+04  337.348022  21.453243           0.045296
1598869  8.639950e+04   94.835136 -13.423030       -9999.000000
1598870  8.639950e+04  105.187111   0.648844           0.028087
1598871  8.639950e+04   97.615601 -11.097078       -9999.000000

[1598872 rows x 4 columns]
You would do the same in matlab. (Also note the "mean_square_slope_uncertainty" variable, which I ignored here in my example.)

2120221999
Posts: 5
Joined: Sun Dec 29, 2024 1:01 pm America/New_York
Answers: 0

Re: Read and process cygnss L2 V2.1 NetCDF4 files

by 2120221999 » Tue Mar 25, 2025 10:01 pm America/New_York

Thank you very much for your reply

Post Reply