I am grateful to all of you from this forum for patently helping with these questions.
I generated OLI, MSI, and OLCI L2 products using l2gen on my linux machine and saved output files in NetCDF formate. Then I reprojected these files using SeaDAS GUI. I chose WGS84 projection and nc as the output data format. I got reprojected nc files but when I try to get ncdump, I get this message: ncdump: NetCDF: Unknown file format! Also, later on when I try to open the reprojected files in SeaDAS GUI I get this message: No appropriate reader found.
I have followed this procedure before with OLI L2 data and have successfully created/read/displayed reprojected files! I am not sure what is the issue now!
I'd appreciate it if you have any suggestion to resolve this.
You should make sure you did get NetCDF format files, first using the linux "file" command. Note that NetCDF4 is actually a subset of HDF5, so:
$ file A2006167181000.L2_reprojected.nc
A2006167181000.L2_reprojected.nc: Hierarchical Data Format (version 5) data
Ah yes! I closed the file and now I can open it! Thanks so much for your help. I truly appreciate it.
I have a question for l2gen processing (on Linux using command line). I have a series of OLI, MSI, OLCHI L1 images that I am trying to convert to L2 using l2gen. These data come in tiles and all I need sometimes is a small portion of the tile that covers a part of the water body I am interested in! Is there a procedure/routine to crop L1 images to a specific shapefile or lat-lon polygon using command line options so that I do not have convert entire tile to L2?
Thanks a lot.
l2genhas options to select a range of pixels and lines:
l2gen | egrep pixl\|line
be specified on the commandline, or put into a parameter file, or the
two methods can be used together, with commandline over-riding.
ilist (ifile) = file containing list of input files, one per line
spixl (int) (default=1) = start pixel number
epixl (int) (default=-1) = end pixel number (-1=the last pixel)
dpixl (int) (default=1) = pixel sub-sampling interval
sline (int) (default=1) = start line number
eline (int) (default=-1) = end line number (-1=the last line)
dline (int) (default=1) = line sub-sampling interval
0: linear interpolation
from retrieved fluorescence line height
sl_pixl (int) (default=-1) = SeaWiFS only, number of LAC pixels for
ybox (int) (default=-1) = number of scan lines on either side of the SW point
You can get pixel and line values using:
lonlat2pixline 6.5.2 (Aug 16 2019 12:47:59)
Usage (box): lonlat2pixline [-x box-halfwidth] [-y box-halfheight] [-r res]
[-v] infile [geofile] SWlon SWlat NElon NElat
Usage (pix): lonlat2pixline [-x box-halfwidth] [-y box-halfheight] [-r res]
[-v] [-F] infile [geofile] lon lat
infile is either a L1B, L2, or GEO filename
geofile is the GEO filename used for MODIS L1B or VIIRS L1 files
-r res resolution for MODIS Files (1000,500,250)
-x val min number of pixels on either side of location to include
-y val min number of scan lines on top and bottom of location to include
-F return 110 if full-box can't be extracted and
120 if full file would be extracted
-v print more verbose messages
-o file output to file instead of stdout
return 0 everything OK
100 location not found in scene
110 full box not extracted using the -F option
120 the whole file is inside the given coordinates, using -F
other error number
l1aextract_modis l1aextract_seawifs l1aextract_viirs l1bextract_meris.
So not all sensors have L1 subset or extract programs: l2gen can just omit data outside the specified region, but does requires sensor-specific programming to get the (pixel,line) values.
I don't know which sensors are supported by
lonlat2pixline, but some sensors have additional tools from the responsible organizations.
I am trying to use gpt.sh for re-projection. It uses ReprojectGeoLatLon.xml. Here are some lines from the sample fileI found from GptCookbook . For the spheroid, 637837.0 is earth's radius but not sure what 298.0 is. Also, in UNIT["degree",0.017453292519943295] what does 0.017453292519943295 represent? Do the numbers 298 and 0.017453292519943295 change with sensor/resolution?
SPHEROID["WGS84", 6378137.0, 298.257223563]],
AXIS["Geodetic longitude", EAST],
AXIS["Geodetic latitude", NORTH]]
Also, when I try to execute gpt.sh I get the following error:
Error: gov/nasa/gsfc/seadas/bathymetry/operator/BathymetryOp$Spi : Unsupported major.minor version 52.0
You are attempting to run
gpt.shwith an old Java runtime version, see: Unsupported major.minor version error. The
$SEADAS_HOME/bin/detect_java.sh. This script is supposed to check the Java version, but apparently it needs updating to exclude JRE 1.7. At the end of the current
detect_java.shthere is a message:
echo No suitable Java Virtual Machine could be found on your system.
echo The version of the JVM must be at least 1.6.
echo Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
echo You can also try to delete the JVM cache file $HOME/.install4j
I tried setting
INSTALL4J_JAVA_HOMEto a recent JVM but
gpt.shstill used the version found in the
PATH. Can you remove the 1.7 JRE? I assume you have an Oracle 1.8 JRE for the SeaDAS 7 GUI (I use the JRE from ESA SNAP). You can edit the line that invokes Java in
"<path_to_1.8_jre>/bin/java" -showversion \
"$HOME/snap/jre/bin/java" -showversion \
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
gpt <op>|<graph-file> [options] [<source-file-1> <source-file-2> ...]