/*************************************************************************** * Copyright (C) 2010 by Nicolas PASCAL * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pmfiledata.h" int main(int argc, char *argv[]) { string fname("/DATA/MULTI_SENSOR/PM_L2/2008/2008_08_04/PM02_L2.2008080401462632.084147.1.34.hdf"); // string fname("/DATA/LIENS/MULTI_SENSOR/PM_L2/2009/2009_01_01/PM02_L2.2009010105561227.094004.1.34.hdf"); PMFileData fd(fname); /* print out some informations read in the filename */ cout<<"File "< v_igrid ( 2 ); /* igrid -> ( lat, lon ) */ v_igrid [0] = 1620, v_igrid [1] = 630; fd.get_pixel_coord ( v_igrid, lat, lon, time ); printf ( "igrid [ %d, %d ] -> pos ( %f, %f )\n", v_igrid [0] , v_igrid [1], lat, lon ); /* ( lat, lon ) -> igrid */ lat = 90., lon = -180.; fd.geolocation_to_grid( lat, lon, igrid ); printf ( "pos ( %f, %f ) -> igrid [ %d, %d ]\n", lat, lon, igrid [0], igrid [1] ); lat = -0.027777778, lon = -163.02777; fd.geolocation_to_grid( lat, lon, igrid ); printf ( "pos ( %f, %f ) -> igrid [ %d, %d ]\n", lat, lon, igrid [0], igrid [1] ); /* irow_shift */ printf ( "irow = %d -> shift = %hd\n", igrid [0], fd.get_irow_shift_data()[ igrid [0] ] ); /* ( lat, lon ) -> idata */ int idata [2]; fd.get_index ( lat, lon, idata ); printf ( "pos ( %f, %f ) -> igrid [ %d, %d ]\n", lat, lon, idata [0], idata [1] ); lat = -58.709625, lon = -166.23706; fd.get_index ( lat, lon, idata ); fd.geolocation_to_grid( lat, lon, igrid ); printf ( "pos ( %f, %f ) -> igrid [ %d, %d ]\tidata [ %d, %d ]\n", lat, lon, igrid [0], igrid [1], idata [0], idata [1] ); lat = -58.66659, lon = -166.26366; fd.get_index ( lat, lon, idata ); fd.geolocation_to_grid( lat, lon, igrid ); printf ( "pos ( %f, %f ) -> igrid [ %d, %d ]\tidata [ %d, %d ]\n", lat, lon, igrid [0], igrid [1], idata [0], idata [1] ); fd.free_geolocation_data(); return 0; }