Radiative transfer model Python wrappers

Sun 23 March 2014

Filed under Blog

Tags python radiative transfer

I use radiative transfer (RT) models quite extensively. While most of the ones you might want to use practically are not very complicated to get your head around, they are numerically expensive (what with all these numerical integration going on). So while you could code them up in Python, it's typically much simpler to just grab the original code (tradiationally written in Fortran), and create wrappers for them. This is quite simple using f2py. So I have put together some easy-to use wrappers for some RT models that you can easily install using pip or easy_install.

Prospect+Sailh (PROSAIL)

The SAIL model from Verhoef is a turbid medium canopy model. It has a basic description of the canopy in terms of leaf area index, leaf angle distribution, a hotspot parameterisation, and requires leaf transmittance, relflectance, as well as a soil reflectance term. Leaf spectral parameters typically come from a leaf level radiative transfer model, typically PROSPECT (Jacquemoud). The soil spectrum can be itself a model like SOILSPECT or something like that, but since the main assumption is that it's lambertian, a simple spectrum will do. Price functions are a reasonable soil spectral model.

 for location in loc1 loc2
 do
   for i in `find ${ROOT}/${location} -iname "*shp"`
   do
     fname=`basename $i .shp`
     touch /tmp/${location}.csv
     ogr2ogr -f "CSV"  -append -dialect "sqlite" \
         -sql "SELECT id, month, doy_min, doy_max, n_pixels, ST_X(ST_Centroid(GEOMETRY)), ST_Y(ST_Centroid(GEOMETRY)) from $fname" \
         /tmp/${location}.csv $i
   done
done

Note that you can do many things like this. In this particular case, you could subset a particular extent, transform coordinates etc etc using ogr2ogr command line parameters. The process is fast and painless, and provided that you can come up with a suitable find command, very flexible and easy!


Comments


EO & DA Ramblings © J Gomez-Dans Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More