@@ -232,8 +232,8 @@ def makedistrib(self):
232
232
233
233
def makedistrib_nisar (self ):
234
234
"""
235
- Install package to redistributable isce3 docker image with nisar qa and
236
- noise estimator caltool
235
+ Install package to redistributable isce3 docker image with nisar qa,
236
+ noise estimator caltool, and Soil Moisture applications
237
237
"""
238
238
239
239
build_args = f"--build-arg distrib_img={ self .imgname ()} \
@@ -336,7 +336,7 @@ def distribrun(self, testdir, cmd, logfile=None, dataname=None, nisarimg=False,
336
336
337
337
def workflowtest (self , wfname , testname , dataname , pyname , suf = "" , description = "" , arg = "" ):
338
338
"""
339
- Run the specified workflow test using the distrib image.
339
+ Run the specified workflow test using either the distrib or the nisar image.
340
340
341
341
Parameters
342
342
-------------
@@ -348,7 +348,9 @@ def workflowtest(self, wfname, testname, dataname, pyname, suf="", description="
348
348
Test input dataset(s) to be mounted (e.g. "L0B_RRSD_REE1", ["L0B_RRSD_REE1", "L0B_RRSD_REE2"]).
349
349
If None, no input datasets are used.
350
350
pyname : str
351
- Name of the isce3 module to execute (e.g. "nisar.workflows.focus")
351
+ Name of the isce3 module to execute (e.g. "nisar.workflows.focus") or,
352
+ for Soil Moisture (SM) testing, the name of the SAS executable to run
353
+ (e.g. "NISAR_SM_DISAGG_SAS")
352
354
suf: str
353
355
Suffix in runconfig and output directory name to differentiate between
354
356
reference and secondary data in end-to-end tests
@@ -374,15 +376,34 @@ def workflowtest(self, wfname, testname, dataname, pyname, suf="", description="
374
376
# distinguish between the runconfig files for each individual workflow)
375
377
if testname .startswith ("end2end" ):
376
378
inputrunconfig = f"{ testname } _{ wfname } { suf } .yaml"
379
+ shutil .copyfile (pjoin (runconfigdir , inputrunconfig ),
380
+ pjoin (testdir , f"runconfig_{ wfname } { suf } .yaml" ))
381
+ elif testname .startswith ("soilm" ):
382
+ # Executable-dependent. Currently works only for Disaggregation.
383
+ inputrunconfig = f"{ testname } { suf } .txt"
384
+ shutil .copyfile (pjoin (runconfigdir , inputrunconfig ),
385
+ pjoin (testdir , f"runconfig_{ wfname } { suf } .txt" ))
377
386
else :
378
387
inputrunconfig = f"{ testname } { suf } .yaml"
379
- shutil .copyfile (pjoin (runconfigdir , inputrunconfig ),
380
- pjoin (testdir , f"runconfig_{ wfname } { suf } .yaml" ))
388
+ shutil .copyfile (pjoin (runconfigdir , inputrunconfig ),
389
+ pjoin (testdir , f"runconfig_{ wfname } { suf } .yaml" ))
381
390
log = pjoin (testdir , f"output_{ wfname } { suf } " , "stdouterr.log" )
382
- cmd = [f"time python3 -m { pyname } { arg } runconfig_{ wfname } { suf } .yaml" ]
391
+
392
+ if not testname .startswith ("soilm" ):
393
+ cmd = [f"time python3 -m { pyname } { arg } runconfig_{ wfname } { suf } .yaml" ]
394
+ else :
395
+ executable = pyname
396
+ # Executable-dependent. Currently works only for Disaggregation.
397
+ cmd = [f"time { executable } runconfig_{ wfname } { suf } .txt" ]
398
+
383
399
try :
384
- self .distribrun (testdir , cmd , logfile = log , dataname = dataname ,
385
- loghdlrname = f'wftest.{ os .path .basename (testdir )} ' )
400
+ if not testname .startswith ("soilm" ):
401
+ self .distribrun (testdir , cmd , logfile = log , dataname = dataname ,
402
+ loghdlrname = f'wftest.{ os .path .basename (testdir )} ' )
403
+ else :
404
+ # Currently, the SM executables are in the nisar image.
405
+ self .distribrun (testdir , cmd , logfile = log , dataname = dataname , nisarimg = True ,
406
+ loghdlrname = f"wftest.{ os .path .basename (testdir )} " )
386
407
except subprocess .CalledProcessError as e :
387
408
raise RuntimeError (f"Workflow test { testname } failed" ) from e
388
409
@@ -490,6 +511,24 @@ def beamformtest(self, tests=None):
490
511
except subprocess .CalledProcessError as e :
491
512
raise RuntimeError (f"CalTool beamformer tool test { testname } failed" ) from e
492
513
514
+ def soilmtest (self , tests = None ):
515
+ if tests is None :
516
+ tests = workflowtests ['soilm' ].items ()
517
+ for testname , dataname in tests :
518
+ # Note: we will eventually have multiple SM executables, each
519
+ # of which implements a different algorithm. These executables
520
+ # will run the same input test data. It's TBD whether they'll
521
+ # be able to share the same runconfig. The output files should
522
+ # be either written to different directories by executable or
523
+ # should be named to indicate which executable was used, or both.
524
+ #
525
+ # Also, the current plan is for two of the SM executables to be
526
+ # Fortran 90 binaries and the other two to be Python modules.
527
+ soilm_bindir = '/opt/conda/envs/SoilMoisture/bin'
528
+ executables = [ 'NISAR_SM_DISAGG_SAS' ]
529
+ for executable in executables :
530
+ self .workflowtest ("soilm" , testname , dataname , f"{ soilm_bindir } /{ executable } " )
531
+
493
532
def mintests (self ):
494
533
"""
495
534
Only run first test from each workflow
0 commit comments