Hi -
Thanks to Joleen, for the hints. I have decided to follow (Tommy Jasmin's methinks) code found in the VIIRS Formulas plugin. With this background I have been able to do a proof-of-concept script. For the time being, the script has to be run through a formula, because it uses metadata that cannot be accessed directly from the script (see Inquiry 2475, urgent as it refers to pixel metadata) and from the Field Selector (see Inquiry 2477, less urgent as it refers single numbers per granule that can be retrieved from netCDF tools), i.e. on the long run I prefer to run it in the background.
Anyway, in writing the code I have hit on a for-loop construct that never ends:
Code: Select all
for i,rad in enumerate(dnbRadG):
rad=rad/cos(lZAG[i]*pi/180)
whereas the alternative construct works:
Code: Select all
for i in range(len(dnbRadG)):
dnbRadG[i]=dnbRadG[i]/cos(lZAG[i]*pi/180)
dnbRadG is the swath-to-gridded DNB radiation and lZAG is swath-to-gridded lunar zenith angle. Both arrays obviously are of the same dimensions. To me the first construct looks more elegant (and maybe more efficient than the second one?).
I have staged the file NCC.jar on the SSEC server. It contains the formula plugin, the script for the formula and sample DNB file. The formula and script have been reduced to the bare minimum just showing the problem. Any idea what I do wrong? Perhaps, you also see a more efficient way to go through the pixel array, bearing in mind that the final for-loop will contain a couple of if clauses depending on lZA.
cheers, HP