Write L2_LAC_OC.nc data

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
dex252
Posts: 3
Joined: Tue Apr 07, 2020 7:24 am America/New_York
Answers: 0

Write L2_LAC_OC.nc data

by dex252 » Thu Apr 09, 2020 3:58 am America/New_York

Hello, dear forum users!
I am a student and need help reading Ocean Level-2 files to overwrite them further.
The main goal is to display tracks from the .pro format in SeaDAS by converting them to .nc format.
As a source I use NOAA files in .pro format. I need to read the coordinates of the tracks from them and write them in .nc format. Reading the first one is not difficult for me, as there is detailed documentation for it, but I just can't read the .nc format downloaded from Ocean Color Browse (e.g. A2020100035500.L2_LAC_OC.nc). As documentation used https://oceancolor.gsfc.nasa.gov/docs/technical/ocean_level-2_data_products.pdf , but information for binary reading is not enough...I still have no idea about the header file, in particular the number of bytes, data format, byte order. So, I use c# + Kaitai for parsing.

Please tell me where I can find a detailed description of the format .nc?
For example, the documentation for L1b level formats for NOAA looks like this https://www1.ncdc.noaa.gov/pub/data/satellite/publications/podguides/N-15%20thru%20N-19/pdf/2.5%20Section%208.0%20NOAA%20Level%201B%20Database.pdf

Unfortunately, I do not write well in English, I apologize for the errors in the text.

Filters:

OB WebDev - norman
Subject Matter Expert
Subject Matter Expert
Posts: 143
Joined: Tue Feb 09, 2021 8:19 am America/New_York
Answers: 0

Write L2_LAC_OC.nc data

by OB WebDev - norman » Thu Apr 09, 2020 9:00 am America/New_York

Hello,

Our level-2 products are written in NetCDF4/HDF5 format.  Please see this page.
        https://oceancolor.gsfc.nasa.gov/docs/format/l2nc/
The SeaDAS software that we distribute can already read that format.

If you are looking for a more detailed description of the format similar to the
level of detail provided in the NOAA document you linked to, then I refer you
to the developers of the format.

https://portal.hdfgroup.org/display/HDF5/File+Format+Specification
https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/file_structure_and_performance.html#parts_of_netcdf4
https://www.unidata.ucar.edu/software/netcdf/documentation/4.7.4-pre/file_format_specifications.html#netcdf_4_spec

Regards,
Norman

gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has thanked: 1 time

Write L2_LAC_OC.nc data

by gnwiii » Thu Apr 09, 2020 10:29 am America/New_York

Your english is more than adequate.  English is not the native language for many users here, so I try to stick to simple language, but please do ask questions if anything isn't clear. 

I'm not sure what the .pro format is, can you post a link to a sample file?   SeaDAS 7 imports vector data in shapefile format.

Current NASA Ocean Color products use the NetCDF4-CF format, which is a "simplified" subset of HDF5.  Although SeaDAS 7 can work with tracks and positions (pins) I don't think you can save those to "standard" level 2 files that will be useful with the OCSSW Processing software.  That may not matter if your workflow doesn't use the OCSSW programs.  BEAM DIMAP is the "native" format of SeaDAS 7 so may be preferable if your workflow only uses SeaDAS 7.

BEAM dimap format is relatively simple to work with. The header is a separate XML file (.dim) and bands are stored in a .data directory using one file band.  It can also store vector data (tracks).  SeaDAS 7 is based on ESA BEAM (ESA has since replaced BEAM with SNAP), which has a programming tutorial.

Some background:

HDF5 is essentially a filesystem that stores data in a hierarchical tree structure with more extensive metadata than common disk-based filesystems.   The HDF5 software is very complex, so in the vast majority of cases an HDF5 library is used to read the data.   The NetCDF4 library links to the HDF5 library, but provides a simpler interface.   There is a native Java library that supports NetCDF4-CF.  Many programming languages support NetCDF4using the C, C++, or Fortran libraries .  For C# there are some individual projects to provide C# support.  Such projects tend to be incomplete, supporting the files the project author users, but can be missing features the author doesn't use.   HDF5 was developed by the HDF Group (who are currently trying to hire a C# developer, so you are a bit early to the party).

The Kaitai Format Gallery does't appear to have NetCDF, HDF5, or BEAM DIMAP (not surprising given the complexity of these formats).

Using Python to read NASA level-2 files, compute a new product, and add the new product to the level-2 files allows further processing using NASA's OCSSW programs.

dex252
Posts: 3
Joined: Tue Apr 07, 2020 7:24 am America/New_York
Answers: 0

Write L2_LAC_OC.nc data

by dex252 » Thu Apr 09, 2020 10:52 am America/New_York

Thank you, I will study the material you provided!

dex252
Posts: 3
Joined: Tue Apr 07, 2020 7:24 am America/New_York
Answers: 0

Write L2_LAC_OC.nc data

by dex252 » Thu Apr 09, 2020 11:09 am America/New_York

Thanks for the answer! I do not work specifically in SeaDAS, but teachers who work in SeaDAS need to transfer from one format to another.
You are absolutely right, to achieve my goal, any format that the program can read is suitable. I will try with BEAM DIMAP, it really seems easier to implement.

An example of the .pro format in the goolge disk link, the documentation I used to read on this page: http://www.satellite.dvo.ru/contentid-14.html

https://drive.google.com/file/d/1Kbids4SkFVJTwMRTMh1vvANLKO46PH5c/view?usp=sharing

Can you tell me where I can see an example of a .dim file?

gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has thanked: 1 time

Write L2_LAC_OC.nc data

by gnwiii » Fri Apr 10, 2020 9:27 am America/New_York

If you install SeaDAS 7.5 (Java GUI) you can easily create a level-2 .dim (and you will find it helpful in writing programs to manipulate .dim files to be able to inspect the file using SeaDAS).   Just load one of the NASA level-2 files and save it.   You mention "track" data.  In the Ocean Color community this usually refers to "vector" data such as a series of locations from a ship track.  Other groups refer to the swath on the ground that is captured by the satellite.  If you are working with vector data, you can add some sample data as either "pins" (point locations as longitude and latitude) or track data either using a simple ASCII text file or in SeaDAS using a spreadsheet-style window in the GUI.  

BEAM Dimap Format Documentation should be helpful.  Unfortunately, the format of the vector data is "proprietary", so if you need vector data you may need to use the public sources to work out details.

Post Reply