Hi, I am rather new to using snap and I think this is a basic question on using SNAP: How do I apply the same band math expression to certain bands of a product at once? how do I apply the same operation on the same bands of another product. I am looking for a fast way to do easy repetitive tasks. I would rather use the UI (e.g. graphbuilder) but if not possible what python script would work for this?
Thanks for any help,
What you want to do is not possible in the UI. We have it on our todo list, but we did not get so far.
Once we had a scripting console but we removed it because it wasn’t mature enough. We think about to get this back and further improve it.
You can write python scripts. After installing snappy you will find some examples in the snappy folder.
The following post might be of interest for you.
ok got it. I will try snappy and post my problems in the appropriate place for this. Thanks for the fast reply. Keep on the good work.
Seems I forgot the link to the post I’ve mentioned.
Here it is: About the python category
I am using Band math in Sentinel 2B to calculate NDVI. It is a dimensionles quantity. So, should I leave the ‘Unit’ box or enter it with some unit? I am asking this because leaving the unit box empty in case of Sentinel 1 was interfering with the calibration.
You could add dl for dimensionless, if you like. But omitting it should cause any trouble. I wonder why it caused a problem with Sentinel-1 data
how do i write band math expression for converting TOA reflectance value to TOA radiance in band maths.
my expression looks like this
1512.9 * 1.028880315 * B3 * cos(sun_zenith) / PI
U = 1.028880315
ESUN = 1512.9
I am getting error: referenced raster must all be of the same size.
I am trying to convert Green band of the Sentinel 2 Satellite.
The expression is correct, but you need to resample the S2 data first. Use the S2 Resampling (Optical/Geometric/S2 Resampling) operation. But you don’t need to use Band maths for converting reflectances to radiances. You can use the dedicated operator.
It is located in the menu at Optical/Thematic Land Processing/Reflectance to Radiance, but you need to resample first too.
@obarrilero Is it correct that it is located in the Land menu? I would expect it in the Preprocessing section.
Should I re sample the data to 60m resolution?
I tried Optical/Thematic Land Processing/Reflectance to Radiance, but that is giving me following error
problem occurred during processing the target product processing
type: operator exception
I try this after re sampling.
To select the resolution is up to you and depends on your application.
In order to investigate the error, can you tell how you have configured the processor? In addition could you attach the log file please? You can find it by selecting from the menu Help / Show Log Directory. Make sure to reproduce the error first and then attach the messages.log file.
@obarrilero Can you check what is wrong with the processor or the configuration?
I have just tested with a resolution of 10 m and it has worked properly with version 6. I have resampled by using S2Resampling Processor and then I have used the ReflectanceToRadiance processor for getting the radiance of B3.
@Marco, yes, I agree that we should change the location to the Preprocessing section.
@tarun25389 Please, could you tell us exactly what is your processing configuration to try to reproduce the error? On the other hand, the solar irradiance of 1512.9 is for B4. If you have looked in the metadata file to get it, the bandId is not the band name:
bandId=0 -> B1
In any case, if you use the Reflectance2Radiance operator this irradiance will be selected automatically.
what do you mean by processing configuration, sorry, but i am new to this.
I have attached the log file.
messages.log (118.6 KB)
I just meant how you have configured the processor. To which values have you set the parameters?
Sorry, I meant the processing parameters that you select when running the operators.
It seems that you have not selected any band when converting to radiance or that SNAP is not reading properly your input file. Please, could you tell me which is your input for downloading it and test it?
Sorry for the late reply.
I have attached a pdf with screen shots of what parameters i am choosing.
My Input file name is S2A_OPER_MTD_SAFL1C_PDMC_20160209T171558_R019_V20160209T051853_20160209T051853
processing parameter.pdf (156.2 KB)
I have just seen that old products do not contain some tags in the metadata that are used by the Reflectance2Radiance processor. We will try to fix it in the next module update. Meanwhile, you have 2 options:
- To use the band operator as you commented before (please, check that you are using the good irradiance value as commented before)
- To use the Reflectance2Radiance operator: in this case you have to change the product type just before launching the processor: right-click on the product -> Properties and in “Product type” you have to change the name to something that does not start with “S2_MSI_”. After that, when you open the processor, you can introduce manually the irradiance and U value (you should maintain the incidence angle 0 in order to use the internal angle band)
Thank you @obarrilero, I am trying your suggestions, its taking lot of time to process after changing the parameters as you mentioned. is this how it normally happens?
Yes, it could take lot of time…The processing time depends on the number of granules of your product and the selected resolution.
Okay, Thank you for you help.
its been 7 hours now the process is still running, is some thing wrong? please help