pro som_block_corner_meters,filename,blocknum,somupleft,somlowright ; this procedure calculates the meter values ; for the SOM upper left and lower right corners ; of the specified block in the specified file ; ; block number is specified as a value from ; 1 to 180 (NOT 0-based) ; ; NOTE: shouldn't matter which grid is used, ; the meter block corners should be at the ; same point, so just use the first grid fid = EOS_GD_OPEN(filename,/READ) numgrid = EOS_GD_INQGRID(filename,gridlist) gridnames = strsplit(gridlist,',',/EXTRACT) gid = EOS_GD_ATTACH(fid,gridnames[0]) ; get the grid dimensions and corner info for first block status = EOS_GD_GRIDINFO(gid, xdimsize, ydimsize, hdfeos_upleft, hdfeos_lowright) status = EOS_GD_DETACH(gid) status = EOS_GD_CLOSE(fid) ; get SOM corners for first block from HDF-EOS corners in file somupleft1 = [hdfeos_upleft[0],hdfeos_lowright[1]] somlowright1 = [hdfeos_lowright[0],hdfeos_upleft[1]] if (blocknum eq 1) then begin ; use first block values above somupleft = somupleft1 somlowright = somlowright1 exit endif minx = hdfeos_upleft[0] maxx = hdfeos_lowright[0] miny = hdfeos_lowright[1] maxy = hdfeos_upleft[1] xres = (maxx - minx)/xdimsize yres = (maxy - miny)/ydimsize offsets = get_offsets(filename,gridnames[0]) ulx = somupleft1[0] + (xdimsize * (blocknum-1) * xres) uly = somupleft1[1] + (total(offsets[0:blocknum-2]) * yres) lrx = ulx + (xdimsize * xres) lry = uly + (ydimsize * yres) somupleft = dblarr(2) somlowright = dblarr(2) somupleft[0] = ulx somupleft[1] = uly somlowright[0] = lrx somlowright[1] = lry end