l2gen products

Please enter here to ask a question about any NASA Science related topics!
avmehta
Posts: 148
Joined: Mon Feb 03, 2020 10:27 am America/New_York

l2gen products

by avmehta » Fri Apr 17, 2020 2:34 pm America/New_York

Thank you for the suggestion, Sean. I will look into that. So when I use 'reproject' from the GUI, does it do any resampling or binning? How to decide that factor?
I am grateful to all of you from this forum for patently helping with these questions.
Amita

Tags:

avmehta
Posts: 148
Joined: Mon Feb 03, 2020 10:27 am America/New_York

l2gen products

by avmehta » Sat Apr 18, 2020 7:18 pm America/New_York

Hello,
  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.
Thanks.
Amita

gnwiii
Posts: 606
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 1

l2gen products

by gnwiii » Sun Apr 19, 2020 7:15 am America/New_York

If you have SeaDAS display the reprojected file and try to use the file before you close the file in SeaDAS you may not get the complete file because some of the information is cached in memory and not yet written to disk.

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

avmehta
Posts: 148
Joined: Mon Feb 03, 2020 10:27 am America/New_York

l2gen products

by avmehta » Sun Apr 19, 2020 6:26 pm America/New_York

Hello,
  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.
Amita

gnwiii
Posts: 606
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 1

l2gen products

by gnwiii » Sun Apr 19, 2020 6:47 pm America/New_York

Glad to help.  No doubt others will see the same problem and benefit from reading this thread.

l2gen has 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
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
where:
    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

avmehta
Posts: 148
Joined: Mon Feb 03, 2020 10:27 am America/New_York

l2gen products

by avmehta » Mon Apr 20, 2020 12:33 am America/New_York

Thanks. I will try this. I was hopping that I can crop L1 image! That way I can save some time in converting to L2. But I also see from some of the earlier comments in the Forum that for reprojection of L2, entire image has to be there and can't be cropped! Is that right?
Thanks again.
Amita

gnwiii
Posts: 606
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 1

l2gen products

by gnwiii » Mon Apr 20, 2020 8:13 am America/New_York

The l2gen step is the one that takes time.   Cropping L1 files needs different programs for each sensor, so is more work to set up.   We have:

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.

OB SeaDAS - dshea
Subject Matter Expert
Subject Matter Expert
Posts: 214
Joined: Thu Mar 05, 2009 10:25 am America/New_York

l2gen products

by OB SeaDAS - dshea » Mon Apr 20, 2020 8:26 am America/New_York

All sensors that l2gen can read are supported by lonlat2pixline.  Both programs share the same sensor reading code.

don

avmehta
Posts: 148
Joined: Mon Feb 03, 2020 10:27 am America/New_York

l2gen products

by avmehta » Thu Apr 23, 2020 1:00 am America/New_York

Hello,
   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?

GEOGCS["WGS84(DD)",
                  DATUM["WGS84",
                        SPHEROID["WGS84", 6378137.0, 298.257223563]],
                  PRIMEM["Greenwich", 0.0],
                  UNIT["degree", 0.017453292519943295],
                  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

Thanks much.
Amita

gnwiii
Posts: 606
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 1

l2gen products

by gnwiii » Thu Apr 23, 2020 8:02 am America/New_York

The GEOCRS section is a well known text (WKT) representation of the coordinate reference system (CRS).  This is a standard CRS, and is independent of the sensor characteristics.   You can find many examples for WGS84 on the internet, all with the same basic parameters, but more complete metadata. The official details are defined in ISO Standards ($$$), but OpenGeospatial.org has a detailed reference that describes the changes in more recent standards and backwards compatibility.

You are attempting to run gpt.sh with an old Java runtime version, see: Unsupported major.minor version error.   The gpt.sh script uses $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.sh there 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_HOME to a recent JVM but gpt.sh still 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 gpt.sh:

"$app_java_home/bin/java" \ 
to read:
"<path_to_1.8_jre>/bin/java" -showversion \

For example:
"$HOME/snap/jre/bin/java" -showversion \
which gives:
% seadas-7/bin/gpt.sh
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)

Usage:
  gpt <op>|<graph-file> [options] [<source-file-1> <source-file-2> ...]
[...]

Post Reply