L4B Crop Type Processing error

Hello all,

I’ve been encountering this error for a while now.
I’m processing an L4B product but at the final stage of applying the crop mask, it results into error. (Perhaps, because I’m using an L4A product which is an invalid one?) The link below is somewhat related to my issue.

Anyway, here is the log for the error.

Executing Mask by crop mask 51QUU at 2019-12-02 20:49:47.213899
otbcli_BandMath -progress false -exp 'im2b1 == 0 ? 0 : im1b1' -il /mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_51QUU.tif /mnt/archive/isabela19/l4a//S2AGRI_L4A_PRD_S6_20191124T115411_V20180503_20190428_NOTV/TILES/S2AGRI_L4A_V20180503_20190428_T51QUU/IMG_DATA/S2AGRI_L4A_CM_V20180503_20190428_T51QUU.TIF -out '/mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_masked_51QUU.tif?gdal:co:COMPRESS=DEFLATE' int16
Performing post-processing for tile: 51QUV
Executing Mask by crop mask 51QUV at 2019-12-02 20:49:47.215077
otbcli_BandMath -progress false -exp 'im2b1 == 0 ? 0 : im1b1' -il /mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_51QUV.tif /mnt/archive/isabela19/l4a//S2AGRI_L4A_PRD_S6_20191124T115411_V20180503_20190428_NOTV/TILES/S2AGRI_L4A_V20180503_20190428_T51QUV/IMG_DATA/S2AGRI_L4A_CM_V20180503_20190428_T51QUV.TIF -out '/mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_masked_51QUV.tif?gdal:co:COMPRESS=DEFLATE' int16
Mask by crop mask 51QUV done at 2019-12-02 20:49:57.793251. Duration: 0:00:10.578174
Executing Nodata_51QUV at 2019-12-02 20:49:57.793324
gdal_edit.py -a_nodata -10000 /mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_masked_51QUV.tif
Mask by crop mask 51QUU done at 2019-12-02 20:49:58.280694. Duration: 0:00:11.066795
Executing Nodata_51QUU at 2019-12-02 20:49:58.280771
gdal_edit.py -a_nodata -10000 /mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_masked_51QUU.tif
Error running Nodata_51QUV at 2019-12-02 20:49:58.829176. The call returned 1
Performing post-processing for tile: 51QVU
Executing Mask by crop mask 51QVU at 2019-12-02 20:49:58.830087
otbcli_BandMath -progress false -exp 'im2b1 == 0 ? 0 : im1b1' -il /mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_51QVU.tif /mnt/archive/isabela19/l4a//S2AGRI_L4A_PRD_S6_20191124T115411_V20180503_20190428_NOTV/TILES/S2AGRI_L4A_V20180503_20190428_T51QVU/IMG_DATA/S2AGRI_L4A_CM_V20180503_20190428_T51QVU.TIF -out '/mnt/archive/orchestrator_temp/l4b/253/65489-crop-type-fused/crop_type_map_masked_51QVU.tif?gdal:co:COMPRESS=DEFLATE' int16
Processor finished in 9:08:42.959017
Error running Nodata_51QUU at 2019-12-02 20:49:58.959044. The call returned 1

Running into a very similar problem, of successful L4A product creation and stalled L4B. Would welcome any suggestions for how to overcome this.

Number of inputs 1
Computing class counts
Image 0 vector length 11
12 20041
13 6183.27
41 19.5291
74 80.7104
223 109.636
Processing input 0
Image 0 vector length 11
Tile pixels of class 12: 9805
Tile pixels of class 13: 5992
Tile pixels of class 41: 17
Tile pixels of class 74: 76
Tile pixels of class 223: 99
Training samples: 15989
Validation samples: 57
Total pixels of class 12: 9805
Total pixels of class 13: 5992
Total pixels of class 41: 17
Total pixels of class 74: 76
Total pixels of class 223: 99
Total training samples: 15989
Total validation samples: 57

Traceback (most recent call last):
File “/usr/local/bin/gdal_edit.py”, line 328, in
sys.exit(gdal_edit(sys.argv))
File “/usr/local/bin/gdal_edit.py”, line 227, in gdal_edit
ds = gdal.OpenEx(datasetname, gdal.OF_RASTER | gdal.OF_UPDATE, open_options=open_options)
AttributeError: ‘module’ object has no attribute ‘OpenEx’
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/sen2agri_common.py”, line 609, in execute
pool.map(self.internal_postprocess_tile, self.tiles)
File “/usr/lib64/python2.7/multiprocessing/pool.py”, line 250, in map
return self.map_async(func, iterable, chunksize).get()
File “/usr/lib64/python2.7/multiprocessing/pool.py”, line 554, in get
raise self._value
Exception: (‘Error running Nodata_30PVV’, 1)`

Hello,

I’ve tried using the manual mode (terminal). In that case, I just copy the commands from the monitoring tab. Then, you can apply the mask manually using raster calculator (L4Bimage.tif X L4Aimage.tif).

Here is my sample code. Take note that I didn’t include the -maskprod parameter.

sudo /usr/bin/CropTypeFused.py -refp /mnt/upload/Isabela19/sen2agri_1575862508/PH_ISAB_LC_PI_20191126_no_vege.shp -ratio 0.80 -classifier rf -rseed 5 -pixsize 10 -rfnbtrees 200 -rfmax 50 -rfmin 50 -tile-threads-hint 4 -siteid 6 -outdir /home/brentf/Documents/Exploratory/manual_crop_type_temp/ -targetfolder /mnt/archive/isabela19/l4b/ -input L2A....

Regards,
Brent

@brentf Great suggestion - that did the trick, thanks.

@halo_x You’re more than welcome.

Brent