SeaDAS-GPT-Mosaic

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
fjqkszcg
Posts: 12
Joined: Thu Dec 15, 2022 3:24 am America/New_York
Answers: 0

SeaDAS-GPT-Mosaic

by fjqkszcg » Thu Dec 15, 2022 3:30 am America/New_York

In the GPT(command line) mode of SeaDAS, the Mosaic module is used to convert two hdf files,
Such as MOD04_3K.A2015351.0240.061.2017324005815.HDF and MOD04_3K A2015351.0245.061.2017324005735.HDF
unite for Mosaic, specific GPT command is as follows:
gpt mosaicGeneral.xml -p MosaicEx01.par `cat level2Files.txt` -t MOD04_3K.A2015351.0200.dim
There is always a run error after running, Error: No product reader found for file 'cat"
If the GPT command is:
gpt mosaicGeneral.xml -p MosaicEx01.par level2Files.txt -t MOD04_3K.A2015351.0200.dim
There is always a run error after running, Error: No product reader found for file level2Files.txt"

What's the problem, please? Is there anyone willing to help me solve this problem? My E-mail is
fjygwork@163.com.

The content of level2Files.txt is as follows:
MOD04_3K.A2015351.0240.061.2017324005815.hdf
MOD04_3K.A2015351.0245.061.2017324005735.hdf

The content of MosaicEx01.par is as follows:
band=Optical_Depth_Land_And_Ocean
north=31
south=21
west=113
east=123
pixelSize=0.01
resampling=Nearest
crs=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]]

The content of mosaicGeneral.xml is as follows:
<graph id="MosaicGraph">
<version>1.0</version>
<node id="MosaicNode">
<operator>Mosaic</operator>
<sources>
<sourceProducts>${sourceProducts}</sourceProducts>
</sources>
<parameters>
<variables>
<variable>
<name>${band}</name>
</variable>
</variables>
<combine>OR</combine>
<westBound>${west}</westBound>
<northBound>${north}</northBound>
<eastBound>${east}</eastBound>
<southBound>${south}</southBound>
<pixelSizeX>${pixelSize}</pixelSizeX>
<pixelSizeY>${pixelSize}</pixelSizeY>
<resampling>${resampling}</resampling>
<crs>${crs}</crs>
</parameters>
</node>
</graph>

Filters:

OB SeaDAS - xuanyang02
Subject Matter Expert
Subject Matter Expert
Posts: 660
Joined: Tue Feb 09, 2021 5:42 pm America/New_York
Answers: 1
Been thanked: 2 times

Re: SeaDAS-GPT-Mosaic

by OB SeaDAS - xuanyang02 » Thu Dec 15, 2022 12:26 pm America/New_York

There is a known issue that gpt (graph processing tool) command line entries require full file path.

So in your command
gpt mosaicGeneral.xml -p MosaicEx01.par level2Files.txt -t MOD04_3K.A2015351.0200.dim
you need to give full path to
mosaicGeneral.xml
MosaicEx01.par
level2Files.txt
MOD04_3K.A2015351.0200.dim

Also in your level2Files.txt, you also need to give full path to
MOD04_3K.A2015351.0240.061.2017324005815.hdf
MOD04_3K.A2015351.0245.061.2017324005735.hdf

In your mosaicGeneral.xml, you need to add "<expression>${bandExpression}</expression>" to the
<variable></variable> block, so it looks like this --

<variable>
<name>${band}</name>
<expression>${bandExpression}</expression>
</variable>

In your MosaicEx01.par, you need to add the line "bandExpression=Optical_Depth_Land_And_Ocean" .

fjqkszcg
Posts: 12
Joined: Thu Dec 15, 2022 3:24 am America/New_York
Answers: 0

Re: SeaDAS-GPT-Mosaic

by fjqkszcg » Thu Dec 15, 2022 9:32 pm America/New_York

Hello!
Thank you very much for your reply! I have done all the modifications according to your suggestions, but the result is still the same!
The problem seems to be that the level2Files.txt parameter is formatted incorrectly on the command line. According to the GPT reference, it is' cat level2Files.txt 'on UNIX systems, but what is the format of the Window parameter?

【a.bat】
gpt F:\MT\mosaicGeneral.xml -p F:\MT\mosaicEx01.par F:\MT\level2Files.txt -t F:\MT\MOD04_3K.A2015351.0240.dim

【level2Files.txt】
F:\MT\MOD04_3K.A2015351.0240.061.2017324005815.hdf
F:\MT\MOD04_3K.A2015351.0245.061.2017324005735.hdf

【mosaicGeneral.xml】
......
<variables>
<variable>
<name>${band}</name>
<expression>${bandExpression}</expression>
</variable>
</variables>
......

【mosaicEx01.par】
bandExpression=Optical_Depth_Land_And_Ocean
north=31
south=21
west=113
east=123
pixelSize=0.01
resampling=Nearest
crs=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]]
Attachments
2.JPG
2.JPG (46.8 KiB) Not viewed yet
1.JPG
1.JPG (71.93 KiB) Not viewed yet

OB SeaDAS - xuanyang02
Subject Matter Expert
Subject Matter Expert
Posts: 660
Joined: Tue Feb 09, 2021 5:42 pm America/New_York
Answers: 1
Been thanked: 2 times

Re: SeaDAS-GPT-Mosaic

by OB SeaDAS - xuanyang02 » Fri Dec 16, 2022 9:43 am America/New_York

It seems that "type" is the windows equivalent of "cat" in unix -- https://www.shellhacks.com/windows-cat-equivalent-cmd-powershell/

Maybe you can try

gpt F:\MT\mosaicGeneral.xml -p F:\MT\mosaicEx01.par 'type F:\MT\level2Files.txt' -t F:\MT\MOD04_3K.A2015351.0240.dim

You MosaicEx01.par should be
band=Optical_Depth_Land_And_Ocean
bandExpression=Optical_Depth_Land_And_Ocean
north=31
south=21
west=113
east=123
pixelSize=0.01
resampling=Nearest
crs=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]]

OB SeaDAS - xuanyang02
Subject Matter Expert
Subject Matter Expert
Posts: 660
Joined: Tue Feb 09, 2021 5:42 pm America/New_York
Answers: 1
Been thanked: 2 times

Re: SeaDAS-GPT-Mosaic

by OB SeaDAS - xuanyang02 » Fri Dec 16, 2022 10:11 am America/New_York

By the way, in SeaDAS GUI, you can do Mosaic through Raster -> Geometric -> Mosaicking or
Mosaic24.png
Mosaic24.png (553 Bytes) Not viewed yet


https://seadas.gsfc.nasa.gov/help-8.3.0/desktop/Mosaic.html

fjqkszcg
Posts: 12
Joined: Thu Dec 15, 2022 3:24 am America/New_York
Answers: 0

Re: SeaDAS-GPT-Mosaic

by fjqkszcg » Fri Dec 16, 2022 2:38 pm America/New_York

Hello!
Thank you very much for your professional guidance! First of all, your instructions on the "SeaDAS-MOD04" post, I understand the reason for the error, I will try to solve it by replacing "NA" with "OUS" or "OUB" method, thanks! Regarding the "SeaDAS-GPT-Mosaic" post, I tried it out according to your latest guidelines, but unfortunately the problem still hasn't been solved.
If we are dealing with a small amount of satellite data, we can directly use the SeaDAS-GUI/Reproject/Mosaic module, which has no problem! But, since I often need to process satellite data of many observation times in a short time, if one observation time does not involve multiple data, reproject method can also be adopted in batch processing, such as processing Himawari-8 satellite data:
【a.bat】
......
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221021_0500_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221021_0500_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221021_0600_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221021_0600_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221021_0700_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221021_0700_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221021_0800_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221021_0800_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221024_0000_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221024_0000_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221024_0100_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221024_0100_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221024_0200_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221024_0200_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221024_0300_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221024_0300_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221024_0400_1HARP031_FLDK.02401_02401.nc -t F:\NC
\H08_20221024_0400_1HARP031_FLDK.02401_02401_Proj.dim
Call GPT Reproj_Parameter.xml -p Reproj_Variable.par -Ssource=F:\NC\H08_20221024_0500_1HARP031_FLDK.02401_02401.nc -t F:\NC
......
【a.bat】

However, some satellite data, such as MODIS satellite data, often involve two pieces of data in one observation time. Therefore, Mosaic must be used in batch processing to solve the problem.This question has been bothering me for a long time. I really want to get answers to my questions from this SeaDAS professional forum! Thanks you!
Attachments
4.JPG
4.JPG (85.41 KiB) Not viewed yet
1.JPG
1.JPG (80.09 KiB) Not viewed yet
2.JPG
2.JPG (125.83 KiB) Not viewed yet

OB SeaDAS - xuanyang02
Subject Matter Expert
Subject Matter Expert
Posts: 660
Joined: Tue Feb 09, 2021 5:42 pm America/New_York
Answers: 1
Been thanked: 2 times

Re: SeaDAS-GPT-Mosaic

by OB SeaDAS - xuanyang02 » Fri Dec 16, 2022 5:29 pm America/New_York

You may also try this --
gpt F:\MT\mosaicGeneral.xml -p F:\MT\mosaicEx01.par F:\MT\MOD04_3K.A2015351.0240.061.2017324005815.hdf F:\MT\MOD04_3K.A2015351.0245.061.2017324005735.hdf -t F:\MT\MOD04_3K.A2015351.0240.dim

replacing 'type F:\MT\level2Files.txt' with the actual files F:\MT\MOD04_3K.A2015351.0240.061.2017324005815.hdf F:\MT\MOD04_3K.A2015351.0245.061.2017324005735.hdf, so you don't have to worry about 'cat' or 'type'

This is the print out for gpt Mosaic -h:
Usage:
gpt Mosaic [options] <source-file-1> <source-file-2> ...

Description:
Creates a mosaic out of a set of source products.


Source Options:
-SupdateProduct=<file> A product to be updated.
This is an optional source.

Parameter Options:
-Pcombine=<string> Specifies the way how conditions are combined.
Value must be one of 'OR', 'AND'.
Default value is 'OR'.
-Pcrs=<string> The CRS of the target product, represented as WKT or authority code.
Default value is 'EPSG:4326'.
-PeastBound=<double> The eastern longitude.
Valid interval is [-180,180].
Default value is '30.0'.
-PelevationModelName=<string> The name of the elevation model for the orthorectification.
-PnorthBound=<double> The northern latitude.
Valid interval is [-90,90].
Default value is '75.0'.
-Porthorectify=<boolean> Whether the source product should be orthorectified.
Default value is 'false'.
-PpixelSizeX=<double> Size of a pixel in X-direction in map units.
Default value is '0.05'.
-PpixelSizeY=<double> Size of a pixel in Y-direction in map units.
Default value is '0.05'.
-Presampling=<string> The method used for resampling.
Value must be one of 'Nearest', 'Bilinear', 'Bicubic'.
Default value is 'Nearest'.
-PsouthBound=<double> The southern latitude.
Valid interval is [-90,90].
Default value is '35.0'.
-PwestBound=<double> The western longitude.
Valid interval is [-180,180].
Default value is '-15.0'.

Graph XML Format:
<graph id="someGraphId">
<version>1.0</version>
<node id="someNodeId">
<operator>Mosaic</operator>
<sources>
<updateProduct>${updateProduct}</updateProduct>
<sourceProducts>${sourceProducts}</sourceProducts>
</sources>
<parameters>
<variables>
<variable>
<name>string</name>
<expression>string</expression>
</variable>
<.../>
</variables>
<conditions>
<condition>
<name>string</name>
<expression>string</expression>
<output>boolean</output>
</condition>
<.../>
</conditions>
<combine>string</combine>
<crs>string</crs>
<orthorectify>boolean</orthorectify>
<elevationModelName>string</elevationModelName>
<resampling>string</resampling>
<westBound>double</westBound>
<northBound>double</northBound>
<eastBound>double</eastBound>
<southBound>double</southBound>
<pixelSizeX>double</pixelSizeX>
<pixelSizeY>double</pixelSizeY>
</parameters>
</node>
</graph>

fjqkszcg
Posts: 12
Joined: Thu Dec 15, 2022 3:24 am America/New_York
Answers: 0

Re: SeaDAS-GPT-Mosaic

by fjqkszcg » Sat Dec 17, 2022 6:18 am America/New_York

Hello!
According to the method you provided, I have tried it, and the problem that bothered me for a long time has finally been solved under your guidance. I would like to express my great thanks to you! I wish you a happy work!

Post Reply