#include #include #include #include #include #include "cfr.h" #include "issibyteswap.h" /** * Given quad-pol SAR data, calculate the Faraday Rotation at each sample * location and write out its value as a complex number. The Faraday Rotation * is calculated using the method of Bickle nad Bates (1965). * * @note Bickel, S. H., and R. H. T. Bates (1965), Effects of magneto-ionic propagation * on the polarization scattering matrix, pp. 1089,1091. * * @param hhFile the data file containing the HH polarity * @param hvFile the data file containing the HH polarity * @param vhFile the data file containing the HH polarity * @param vvFile the data file containing the HH polarity * @param output the file in which to place the Faraday Rotation * @param numberOfSamples the number of samples in range in the input files * @param numberOfLines the number of samples in azimuth in the input files * @param swap flag for byte swapping */ int cfr(char *hhFile,char *hvFile,char *vhFile,char *vvFile,char *output,int numberOfSamples,int numberOfLines,int swap) { int i,j; float complex *hhData,*hvData,*vhData,*vvData,*ans; FILE *hh,*hv,*vh,*vv,*out; // Open input and output fi les hh = fopen(hhFile,"rb"); hv = fopen(hvFile,"rb"); vh = fopen(vhFile,"rb"); vv = fopen(vvFile,"rb"); out = fopen(output,"wb"); ans = (float complex *)malloc(numberOfSamples*sizeof(float complex)); for(i=0;i