Page 1 of 1

L3b_DAY_CYAN data

Posted: Mon Aug 28, 2023 9:48 pm America/New_York
by wongsydoris
I'm using the merged S3 cyan data "" for my project. The dataset has "BinList" and "BinIndex" as variables. How do I convert bin_num to latitude & longitude locations? Thanks!

Re: L3b_DAY_CYAN data

Posted: Tue Aug 29, 2023 12:24 pm America/New_York
by OB ODPS - towens
Here is the white paper:

If you are using SeaDAS look at the l3bindump utility

Code: Select all

 l3bindump l3bprod=CI_cyano bin_number=4568737875
                                                                                       CI_cyano        CI_cyano
    bin centerlat  centerlon     north     south       west       east    n   N             sum     sum_squared          weight       mean      stdev
------- --------- ---------- --------- --------- ---------- ---------- ---- --- --------------- --------------- --------------- ---------- ----------
4568737875  30.14193  -89.31793  30.14323  30.14062  -89.31944  -89.31642    1   1  4.99999987e-05  2.49999976e-09  1.00000000e+00    0.00005    0.00000

Re: L3b_DAY_CYAN data

Posted: Tue Aug 29, 2023 9:47 pm America/New_York
by wongsydoris
Thank you Tommy for your prompt reply.
I read through the white paper but still couldn't understand how bins are tranlated into lat/lon locations.
Altheratively I found this link:
from another post: viewtopic.php?t=2207#p7783 from 2021. However the link no longer works.

I found a python code translation in another post:
that looks promising. But I'm quite sure how to define "numrows" as an input of the Bin_calc object.

Finally I tried to use l3bindump in SeaDAS, but keep getting the follow error:
execution exception: l3bindump failed with exit code 139.
Check log for more details.
/Users/marcokam/SeaDAS/ocssw/bin/ocssw_runner: line 23: 1745 Segmentation fault: 11 $*

Please see screenshot attached.
I'm using macOS Big Sur 11.7.9, SeaDAS version 8.3.0.
Thank you!

Re: L3b_DAY_CYAN data

Posted: Wed Aug 30, 2023 9:43 am America/New_York
by OB ODPS - towens
One thing I notice is that your product is wrong.

"CI_Cyan" should be "CI_cyano" but I wouldn't expect that to cause a Seg Fault.

I'll leave this for one of our SeaDAS experts to debug.


Re: L3b_DAY_CYAN data

Posted: Thu Aug 31, 2023 4:54 pm America/New_York
by OB.DAAC - SeanBailey
The URL in the post you found was moved with the reorganized website. It now lives here:

The sample code on that page will show you how to get the geolocation for a given bin, however, it doesn't show how to retrieve the geophysical values from the stored bin sums and sums of squares. For that see the appendix in

You may want to just use the l3mapgen program (part of the SeaDAS distribution) to get a raster image that does the math and outputs a geolocated product.


Re: L3b_DAY_CYAN data

Posted: Mon Sep 04, 2023 3:06 pm America/New_York
by wongsydoris
Thanks Sean! This is extremely helpful.

Re: L3b_DAY_CYAN data

Posted: Thu Sep 07, 2023 10:31 am America/New_York
by gnwiii
wongsydoris wrote: Tue Aug 29, 2023 9:47 pm America/New_York [...]
I read through the white paper but still couldn't understand how bins are tranlated [SIC] into lat/lon locations.
It can be a bit tricky to reproduce the integer number of bins for a given latitude band. In the distant past I encountered differences moving to Intel (i386?) from SGI IRIX 64, and later with IDL, Matlab, Octave, R and Python on Intel where some builtin sequence generators used different algorithms. My solution was to use l3bindump with a level-3 binned PAR climatology (PAR is computed where there are clouds, so I never encounter valid data for bins that don't have a climatological PAR value) to get bin numbers and lat/lon locations.

Re: L3b_DAY_CYAN data

Posted: Sat Sep 09, 2023 6:08 pm America/New_York
by wongsydoris
Thanks for your comment gnwiii. My SeaDAS is still not working properly so I can't use l3bindump. ButI actually found a python code that seem to work for me. I modified it a bit so it runs faster. Sharing it here in case anyone is also looking for a way outside of SeaDAS.

def binnum2latlon(binnum, nrows):
latbin = (np.arange(0, nrows, dtype=np.float_) + 0.5) * (180.0 / nrows) - 90.0
numbin = (np.cos(latbin * np.pi / 180.0) * (2.0 * nrows) + 0.5).astype(dtype=np.int_)
basebin = np.cumsum(numbin)+1
basebin = np.insert(basebin, 0, 1)
row = nrows - 1
if binnum < 1:
binnum = 1

row = (binnum >= basebin).sum() - 1
clat = latbin[row]
clon = (360.0 * (binnum - basebin[row] + 0.5) / numbin[row]) - 180.0
return (clat,clon)

Note that "nrows" depends on the resolution of the satelite image.
The L3b_DAY_CYAN data have sensor spatial resolution of 300m, so nrows = 69120 (according to the "binIndexDim" dimension in the nc file).
From this doc on l3bins:
Data with resolution of 9km: nrows = 2160
Data with resolution of 4km: nrows = 4320

Since l3bindump does not work on my laptop, I was only able to test this code with the example Tom provided in an earlier post (i.e. bin 4568737875 translate to clat=30.141927 and clon=-89.317931).

Re: L3b_DAY_CYAN data

Posted: Sun Oct 08, 2023 7:25 am America/New_York
by emavoow
I've observed a potential issue with your product. Specifically, it seems that "CI_Cyan" should be labeled as "CI_cyano." However, I wouldn't anticipate this to result in a Segmentation Fault. I'll leave this matter for one of our SeaDAS experts to investigate further.