I am able to convert as batch the 'Aerosol_Optical_Depth' data set inside MISR(multi-angle image spectro-radiometer) level 2 (MIL2ASAE) swath data to grid data,which is in .nc format, and in 2 dimension using gdal_translate and gdal_warp. I use the following gdal code for that.
#misr swath to grid
``# get the reprojection information, stuff it into
a virtual file (.vrt)
gdal_translate -of VRT HDF5:"$1"://4.4_KM_PRODUCTS/"$2" misr.vrt
# delete the bad ground control points
sed '/X=\"-9.999000000000E+03"/d' misr.vrt > final.vrt
# grab the filename without an extension
# reproject the data using the cleaned up VRT file
gdalwarp -overwrite -tr 0.1 0.1 -of GTIFF -tps -r near -t_srs EPSG:4326 final.vrt "/mnt/d/my/output/path/$filename_$1.tif"
I save this code to a .sh file and place it inside the folder where my input files are and run the following command on linux command prompt
/mnt/d/my/inputfolder$ for i in *.nc; do ./gdal_swath2grdmisr.sh $i Aerosol_Optical_Depth; done
this will batch process the files inside folder converting my required Aerosol_Optical_Depth data-set from swath to grid. But now the problem is in the input file there is another data-set named "Spectral_AOD_Scaling_Coeff", I need to convert it from swath to grid, Actualy I want level 2 AOD of MISR at 660nm, By using this variable I can make it. I have tried it in same way but the output is an error showing:
Input file size is 3, 496
ERROR 1: Unable to compute a GCP_TPS based transformation between pixel/line and georeferenced coordinates for final.vrt
The code is loading an input file of size:Input file size is 3, 496 but actually the file is of size 4032 x 496 x 3, It is a 3d matrix of size x y z, I think the error is because code is taking its y and z dimensions. I have already tried this code for modis l2 AOD variable "Deep_Blue_Spectral_Aerosol_Optical_Depth_Land" it is also a 3d matrix and code is working really well for that, then I don't know why the gdal_translate is taking the y and z instead of x y dimensions of MISR AOD variable "Spectral_AOD_Scaling_Coeff". Is there any way in which gdal_translate allow user to specify the dimension of input datasetn. If anyone have any idea or suggestions about my problem, please help me. If know any other methods other than using GDAL for solving my problem I can use that method too, My intention is only to convert this variable,from swath to grid any method is feasible. I am attaching a sample file and code file sampledata.nc