Ocean Color Forum - Not logged in
Forum Ocean Color Home Help Search Login
Previous Next Up Topic SeaDAS / Non-SeaDAS Packages (e.g. MATLAB, ENVI, GIS, etc) / L3 BIN Mapping in Matlab (locked) (12614 hits)
By Deny Date 2011-12-28 20:33
Hi,

I'm currently working with daily L2 1km MODIS SST and CHL. I'm willing to generate 3-day composites, and the best way I've found is using l2bin (since I can't operate with the L2 matrices if they aren't spatially binned). I am able to map L2 files, but since L2 and L3 files have different structures I am having difficulties to map (and even read) the L3 BIN files in Matlab, using M_Map (as posted by Lachie here:http://oceancolor.gsfc.nasa.gov/forum/oceancolor/topic_show.pl?tid=3369). I've tried displaying and outputing the ascii file, however lat, lon, data are stored in vectors, not matrices, which m_pcolor doesn't plot. What I need is a way to display L3 BIN data the way L2 data is displayed (longitude, latitude, data and quality data matrices), or a way of binning L2 files in Matlab. I've searched the entire forum and found some useful posts, however I'm still stuck at this part. If anyone could help I'd be thankful.

Thanks in advance.
By @sean Date 2011-12-29 14:31
You may want to try using smigen to put the L3bin file into our Standard Mapped Image format.
The resulting file is regularly gridded, and for SST products, contains the quality flag array. 
Latitude and Longitude are not included in the file, but can be easily computed.

Sean
By Deny Date 2011-12-29 19:09
Sean, thanks for your answer. I had already considered this possibility and tried generating SMI files, however I always got the same error ' Unable to find LUT file' (or something like this) and disconsidered the possibility. Do you have an idea of what could be the problem and how I could possibly solve it? Maybe reinstall SeaDAS (I use VA)? I think SMI is really the best solution.

Thanks!
By @sean Date 2011-12-29 19:31
As long as you have the processing code and common files, smigen should work.
If you were able to bin the files using l2bin, then you should be set.  Try smigen again, and if you still have errors, post them so we may be able to assist further.

Sean
By Deny Date 2011-12-30 13:03
Sean, I have no problem using l2bin, but smigen gives this:

' smigen ifile=/disk01/seadas/M20080662008068.L3b_GAC prod=chlor_a meas=1 ofile=M20080662008068_smi_CHLOR_A_mn.hdf stype=2 projection=RECT resolution=1km precision=B latnorth=90.0000 latsouth=-90.0000 lonwest=-180.000 loneast=180.000 datamin=0 datamax=0 pfile=
Error reading palette file

smigen 4.17 (Apr  7 2011 14:39:22) [getlut_file] error opening the lut file'

I've tried loading another palette but it didn't work. What could this possibly be?

Thanks!
By @sean Date 2011-12-30 13:55
Run smigen from the command line as:
smigen ifile=/disk01/seadas/M20080662008068.L3b_GAC prod=chlor_a ofile=M20080662008068_smi_CHLOR_A_mn.hdf resolution=1km

If that works, then add palfile=<full path to palette file>

Sean
By Deny Date 2012-01-02 17:33
Sean, that doesn,t work either. Any idea of what could be wrong?

I'll attach a copy of the palette I'm using.

Attachment: SST_Pathfinder.pal (1.0k)
By @sean Date 2012-01-02 20:29
The palette file needs to be three column RGB ASCII file.  See $SEADASrun/data/common/palette/ for examples.

Sean
By Deny Date 2012-01-02 22:15
There's no '/palette' folder in my 'run/data/common' folder. What should I do? Can you post the link to a sample palette file?
Thanks.
By Deny Date 2012-01-02 23:35
it isn't working, I can't load palfile (which I found here: http://oceancolor.gsfc.nasa.gov/PRODUCTS/colorbars.html):
'seadas@seadas-vm:/disk01/seadas/Desktop$ smigen ifile=/disk01/seadas/M20080662008068.L3b_GAC prod=chlor_a ofile=M20080662008068_smi_CHLOR_A_mn.hdf resolution=1km
smigen 4.17 (Apr  7 2011 14:39:22)
[getlut_file] error opening the lut file
Error reading palette file'
By @sean Date 2012-01-03 15:18
The call to smigen didn't specify a palette file, which means the code will for the default palette for the given product.
These are found in $SEADAS/run/data/common/palette/

Since you don't have them, you may be missing the common data files.

Sean
By Deny Date 2012-01-04 15:57
Thanks Sean, the common files were missing indeed (It seems I hadn't unziped the files correctly).
I've already generated the SMI file, now I'll try to find lat/lon and plot on Matlab.
By Deny Date 2012-01-04 17:34 Edited 2012-01-04 18:16
Sean, I've been able to create lat and lon matrices and map the data on Matlab.
However, I have a doubt concerning chl values. Opening the SMI on Matlab I got
a 288x288 matrix, as you posted here http://oceancolor.gsfc.nasa.gov/forum/oceancolor/topic_show.pl?pid=13829#pid13829
slope and intercept are 1 and 0, so the values should already be in mg/m³. Instead, the matrix contains values ranging from
14 to 255. How do I derive the chl concentration values from these?

edit: displaying the SMI in SeaDAS I found slope:0.01320; intercept:-2.

Are the 255 values, cloud and land masks?

By @sean Date 2012-01-04 19:19
smigen can output products as scaled integers (bytes or 16bit)  and float.  The defaults file tells the code what to use
UNLESS it is overridden by user input (the precision argument).  The general default is 'B' - for byte.  It sounds like
your file was output as a scaled byte array rather than a float array.  For details of the format see the specification documentation.
You can ensure float output by including:
precision=F

Sean
By Deny Date 2012-01-05 19:44 Edited 2012-01-05 19:47
Sean, thanks. I just changed the precision from B to F (why this can't be done on the GUI?).
I have just one more question. Why do CHL and SST images from the same day have different contamination? A cloud for example should appear on both, but that's not what I've noticed.
Here is a sample of the resulting images:

By @sean Date 2012-01-05 19:56
The GUI can select byte or int16, however, it wasn't updated when smigen was modifed  to also output floats.
CHL and SST use different flagging.  What is a "cloud" for CHL (well, visible bands) isn't necessarily a cloud
for SST (infrared bands).

Sean
By Deny Date 2012-01-06 11:21
It sounds so obvious now! HAHA

Thanks!
By Yongjiu Date 2012-01-28 14:56
deny, how you did that, can you help to share some script to run in the Matlab, i also can run L2 files(including log, lat), but cannot run after binned L3(only Hdf, no lon, lat) files.
thanks
joe
Previous Next Up Topic SeaDAS / Non-SeaDAS Packages (e.g. MATLAB, ENVI, GIS, etc) / L3 BIN Mapping in Matlab (locked) (12614 hits)



Responsible NASA Official: Gene C. Feldman
Curator: OceanColor Webmaster
Authorized by: Gene C. Feldman
Updated: 27 November 2007
Privacy Policy and Important Notices NASA logo