L3b_DAY_CYAN data
-
- Posts: 4
- Joined: Mon Aug 28, 2023 9:43 pm America/New_York
L3b_DAY_CYAN data
I'm using the merged S3 cyan data "L3b_DAY_CYAN.nc" for my project. The dataset has "BinList" and "BinIndex" as variables. How do I convert bin_num to latitude & longitude locations? Thanks!
Filters:
-
- Subject Matter Expert
- Posts: 450
- Joined: Fri Feb 05, 2021 9:17 am America/New_York
- Been thanked: 7 times
Re: L3b_DAY_CYAN data
Here is the white paper:
https://oceancolor.gsfc.nasa.gov/docs/format/Ocean_Level-3_Binned_Data_Products.pdf
If you are using SeaDAS look at the l3bindump utility
Tommy
https://oceancolor.gsfc.nasa.gov/docs/format/Ocean_Level-3_Binned_Data_Products.pdf
If you are using SeaDAS look at the l3bindump utility
Code: Select all
l3bindump ifile=L2023229.L3b_DAY_CYAN.nc 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
-
- Posts: 4
- Joined: Mon Aug 28, 2023 9:43 pm America/New_York
Re: L3b_DAY_CYAN data
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: https://oceancolor.gsfc.nasa.gov/docs/format/l3bins/
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: https://clouds.eos.ubc.ca/~phil/courses/eosc582/html/find_bins.html
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: java.io.IOException: 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!
I read through the white paper but still couldn't understand how bins are tranlated into lat/lon locations.
Altheratively I found this link: https://oceancolor.gsfc.nasa.gov/docs/format/l3bins/
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: https://clouds.eos.ubc.ca/~phil/courses/eosc582/html/find_bins.html
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: java.io.IOException: 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!
- Attachments
-
- Screen Shot 2023-08-29 at 9.44.09 PM.png (35.42 KiB) Not viewed yet
-
- Screen Shot 2023-08-29 at 9.43.54 PM.png (43.74 KiB) Not viewed yet
-
- Subject Matter Expert
- Posts: 450
- Joined: Fri Feb 05, 2021 9:17 am America/New_York
- Been thanked: 7 times
Re: L3b_DAY_CYAN data
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.
Tommy
"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.
Tommy
-
- Posts: 1519
- Joined: Wed Sep 18, 2019 6:15 pm America/New_York
- Been thanked: 9 times
Re: L3b_DAY_CYAN data
The URL in the post you found was moved with the reorganized website. It now lives here:https://oceancolor.gsfc.nasa.gov/resources/docs/format/l3bins/
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 https://oceancolor.gsfc.nasa.gov/images/resources/seawifs/PreLVol32.pdf
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.
Sean
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 https://oceancolor.gsfc.nasa.gov/images/resources/seawifs/PreLVol32.pdf
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.
Sean
-
- Posts: 4
- Joined: Mon Aug 28, 2023 9:43 pm America/New_York
Re: L3b_DAY_CYAN data
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.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.
[...]
-
- Posts: 4
- Joined: Mon Aug 28, 2023 9:43 pm America/New_York
Re: L3b_DAY_CYAN data
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: https://oceancolor.gsfc.nasa.gov/resources/docs/format/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).
================================
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: https://oceancolor.gsfc.nasa.gov/resources/docs/format/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
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.