comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: problem with subset one image by another
items: Re: problem with subset one image by another

problem with subset one image by another
type: item
description: Hello all! Could anybody help me with spatial subsetting one image by another in idl. It's easy in Envi, but I must process a large number of files. Thanks! Gulshat *** Sent From/Enviado desde: http://groups.expo.st ***
creator: chemsat
date: 2008-03-22T01:49:18-00:00

Re: problem with subset one image by another
type: item
description: negra wrote: > On 22 О©╫О©╫О©╫, 22:12, David Fanning <n...@dfanning.com> wrote: >> negra writes: >> Well, there probably is nothing easier than this in IDL, >> either, so I think folks are either waiting for you to >> realize this or waiting for you to explain in a little >> more detail exactly what it is you are trying to do. :-) >> >> Cheers, >> >> David >> -- > I have a large number of georeferenced MODIS images in ENVI. And it's > just attempt to get rid from leaving for area of interest of > territory. Are these Level 2 images, or Level 3? Level 2 products are organized around 5-minute granules of data, and are generally in HDF-EOS Swath format. For best results, a Geolocation (MOD03 or MYD03) file should be used for georeferencing such data. Level 3 images are rebinned to a rectangular grid in som particular map projection (often sinusoidal), and are stored in HDF-EOS Grid format. The techniques that should be used are somewhat different in the two cases. And, as David said, we need a whole lot more details about what it is you are trying to do.
creator: jameskuyper
date: 2008-03-26T19:52:59-00:00

Re: problem with subset one image by another
type: item
description: On 27 мар, 01:52, James Kuyper <jameskuy...@verizon.net> wrote: > negra wrote: >> On 22 ÍÁÒ, 22:12, David Fanning <n...@dfanning.com> wrote: >>> negra writes: >>> Well, there probably is nothing easier than this in IDL, >>> either, so I think folks are either waiting for you to >>> realize this or waiting for you to explain in a little >>> more detail exactly what it is you are trying to do. :-) > >>> Cheers, > >>> David >>> -- >> I have a large number of georeferenced MODIS images in ENVI. And it's >> just attempt to get rid from leaving for area of interest of >> territory. > > Are these Level 2 images, or Level 3? Level 2 products are organized > around 5-minute granules of data, and are generally in HDF-EOS Swath > format. For best results, a Geolocation (MOD03 or MYD03) file should be > used for georeferencing such data. > > Level 3 images are rebinned to a rectangular grid in som particular map > projection (often sinusoidal), and are stored in HDF-EOS Grid format. > > The techniques that should be used are somewhat different in the two cases. > > And, as David said, we need a whole lot more details about what it is > you are trying to do. It's images processed from Level1 or Level 0 to Level 2 products. Some I take them from our receiving station, others, when we have problems with receiving, I take as 5-minute granules of data as Level 0 (pds) from ftp. Then I process them till level 2 product. And georefernce in IDL (because I have IDL routine for processing a large number of data) to geografical projection. And then I calculate indexes what I need. For example it's Vegetation, Snow, Dust and other calculations. For different arithmetic procedures in ENVI&IDL I must have same size images. May be it would be easier if I will subset by coordinates of four corner? But some times images smaller than the area of interest(AOI). Because AOI it's the territory of whole our country. In this case, I have procedure of filling by null data till needed size. But in futu…
creator: negra
date: 2008-03-27T02:10:09-00:00

Re: problem with subset one image by another
type: item
description: negra wrote: ... > It's images processed from Level1 or Level 0 to Level 2 products. Some > I take them from our receiving station, others, when we have problems > with receiving, I take as 5-minute granules of data as Level 0 (pds) > from ftp. Then I process them till level 2 product. And georefernce in > IDL (because I have IDL routine for processing a large number of data) > to geografical projection. And then I calculate indexes what I need. > For example it's Vegetation, Snow, Dust and other calculations. > For different arithmetic procedures in ENVI&IDL I must have same size > images. May be it would be easier if I will subset by coordinates of > four corner? > But some times images smaller than the area of interest(AOI). Because > AOI it's the territory of whole our country. In this case, I have > procedure of filling by null data till needed size. But in future I > plan to use this procedure (If I wrote it :-)) certainly) to smaller > regions. OK, that makes it a little bit clearer what you are doing. What we need is more details about what it is that you want to do, and haven't figured out how to do. What have you tried? What's wrong with the approaches you have tried?
creator: jameskuyper
date: 2008-03-27T11:40:28-00:00

Re: problem with subset one image by another
type: item
description: (If I wrote it :-)) certainly) to smaller >> regions. > > OK, that makes it a little bit clearer what you are doing. What we need > is more details about what it is that you want to do, and haven't > figured out how to do. What have you tried? What's wrong with the > approaches you have tried? In helps for ENVI&IDL, ittvis and other web sites I don't find something what I could use. I don't know even from what to begin. And without experience in programming it's still difficultly, write this procedure independently.
creator: negra
date: 2008-03-27T12:47:07-00:00

Re: problem with subset one image by another
type: item
description: negra wrote: > (If I wrote it :-)) certainly) to smaller >>> regions. >> OK, that makes it a little bit clearer what you are doing. What we need >> is more details about what it is that you want to do, and haven't >> figured out how to do. What have you tried? What's wrong with the >> approaches you have tried? > > > In helps for ENVI&IDL, ittvis and other web sites I don't find > something what I could use. I don't know even from what to begin. And > without experience in programming it's still difficultly, write this > procedure independently. Don't concentrate on how to do it; that's never the right place to begin. First, concentrate on clearly describing what it is you want to do. What do you start with, and what do you want to have when it's finished? Don't worry about the details of how to program it and what tools to use until you've taken care of the first part. Without more details about what you want to do it is difficult, bordering upon impossible, for us to give you any useful advice about how to do it.
creator: jameskuyper
date: 2008-03-27T13:54:49-00:00

Re: problem with subset one image by another
type: item
description: > > Without more details about what you want to do it is difficult, > bordering upon impossible, for us to give you any useful advice about > how to do it. here is idl routine what I written. The beginning of it, is working. pro spat_subset cd, 'C:\Scandata\L1a' HKMfiles = FILE_SEARCH('MOD02HKM.*.img',count=numfiles) PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img')) print, FILE_SEARCH(HKMfiles) for j=0,numfiles-1 DO BEGIN HKM_name = HKMfiles[j] print,HKM_name ;first restore all base save files ; envi, /restore_base_save_files ; ;Initialize ENVI and send all errors and warnings to the file batch.txt ; envi_batch_init, log_file='batch.txt' ; ;Open the input files ;kz_hkm mask file envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=file1_fid if (file1_fid eq -1) then begin envi_batch_exit return endif envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=file_fid if (file_fid eq -1) then begin envi_batch_exit return endif envi_file_query, file1_fid, dims=file1_dims, ns=file1_ns, nl=file1_nl, nb=file1_nb file1_dims = [-1L,0,file1_ns-1,0,file1_nl-1] file1_mapinfo = envi_get_map_info(fid=file1_fid) print, file1_mapinfo file1_xf = [0,file1_ns-1] file1_yf = [0,file1_nl-1] envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf, file1_xmap, file1_ymap, /to_map print, 'UL corner:',file1_xmap[0],file1_ymap[0] print, 'LR corner:',file1_xmap[1],file1_ymap[1] ;Longitude 44.39011111 - 88.38219444 ;Latitude 36.20264722 - 56.35832500 ;subset #1 envi_file_query, file_fid, dims=file_dims, ns=file_ns, nl=file_nl, nb=file_nb file_dims = [-1L,0,file_ns-1,0,file_nl-1] file_mapinfo = envi_get_map_info(fid=file_fid) print, file_mapinfo pos = lindgen(file_nb) out_namea = HKMfiles[j]+'subset.img' file_mapinfo = envi_get_map_info(fid=file_fid) _xfactor = file1_mapinfo.ps[0]/file_mapinfo.ps[0] _yfactor = file1_mapinfo.ps[1]/file_mapinfo.ps[1] print, [_xfactor, _yfactor] file_xf = [0,file_ns-1] file_yf = [0,file_nl-1] envi_convert_file_coordinates, file_fid, file_xf, file_y…
creator: negra
date: 2008-03-27T15:40:16-00:00

Re: problem with subset one image by another
type: item
description: negra wrote: >> Without more details about what you want to do it is difficult, >> bordering upon impossible, for us to give you any useful advice about >> how to do it. > > here is idl routine what I written. The beginning of it, is working. > pro spat_subset > cd, 'C:\Scandata\L1a' > HKMfiles = FILE_SEARCH('MOD02HKM.*.img',count=numfiles) > PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img')) > print, FILE_SEARCH(HKMfiles) > for j=0,numfiles-1 DO BEGIN > HKM_name = HKMfiles[j] > print,HKM_name > ;first restore all base save files > ; > envi, /restore_base_save_files > ; > ;Initialize ENVI and send all errors and warnings to the file > batch.txt > ; > envi_batch_init, log_file='batch.txt' > ; > ;Open the input files > ;kz_hkm mask file > envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=file1_fid > if (file1_fid eq -1) then begin > envi_batch_exit > return > endif > envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=file_fid > if (file_fid eq -1) then begin > envi_batch_exit > return > endif > envi_file_query, file1_fid, dims=file1_dims, ns=file1_ns, nl=file1_nl, > nb=file1_nb > file1_dims = [-1L,0,file1_ns-1,0,file1_nl-1] > file1_mapinfo = envi_get_map_info(fid=file1_fid) > print, file1_mapinfo > file1_xf = [0,file1_ns-1] > file1_yf = [0,file1_nl-1] > envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf, > file1_xmap, file1_ymap, /to_map > print, 'UL corner:',file1_xmap[0],file1_ymap[0] > print, 'LR corner:',file1_xmap[1],file1_ymap[1] > ;Longitude 44.39011111 - 88.38219444 > ;Latitude 36.20264722 - 56.35832500 > ;subset #1 > > envi_file_query, file_fid, dims=file_dims, ns=file_ns, nl=file_nl, > nb=file_nb > file_dims = [-1L,0,file_ns-1,0,file_nl-1] > file_mapinfo = envi_get_map_info(fid=file_fid) > print, file_mapinfo > pos = lindgen(file_nb) > out_namea = HKMfiles[j]+'subset.img' > file_mapinfo = envi_get_map_info(fid=file_fid) > _xfactor = file1_mapinfo.ps[0]/file_mapinfo.ps[0] > _yfactor = file1_mapinfo.ps[1]/file_mapinfo.ps[1] > prin…
creator: Jean H.
date: 2008-03-27T15:56:34-00:00

Re: problem with subset one image by another
type: item
description: On 27 мар, 21:56, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca> wrote: > negra wrote: >>> Without more details about what you want to do it is difficult, >>> bordering upon impossible, for us to give you any useful advice about >>> how to do it. > >> here is idl routine what I written. The beginning of it, is working. >> pro spat_subset >> cd, 'C:\Scandata\L1a' >> HKMfiles = FILE_SEARCH('MOD02HKM.*.img',count=numfiles) >> PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img')) >> print, FILE_SEARCH(HKMfiles) >> for j=0,numfiles-1 DO BEGIN >> HKM_name = HKMfiles[j] >> print,HKM_name >> ;first restore all base save files >> ; >> envi, /restore_base_save_files >> ; >> ;Initialize ENVI and send all errors and warnings to the file >> batch.txt >> ; >> envi_batch_init, log_file='batch.txt' >> ; >> ;Open the input files >> ;kz_hkm mask file >> envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=file1_fid >> if (file1_fid eq -1) then begin >> envi_batch_exit >> return >> endif >> envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=file_fid >> if (file_fid eq -1) then begin >> envi_batch_exit >> return >> endif >> envi_file_query, file1_fid, dims=file1_dims, ns=file1_ns, nl=file1_nl, >> nb=file1_nb >> file1_dims = [-1L,0,file1_ns-1,0,file1_nl-1] >> file1_mapinfo = envi_get_map_info(fid=file1_fid) >> print, file1_mapinfo >> file1_xf = [0,file1_ns-1] >> file1_yf = [0,file1_nl-1] >> envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf, >> file1_xmap, file1_ymap, /to_map >> print, 'UL corner:',file1_xmap[0],file1_ymap[0] >> print, 'LR corner:',file1_xmap[1],file1_ymap[1] >> ;Longitude 44.39011111 - 88.38219444 >> ;Latitude 36.20264722 - 56.35832500 >> ;subset #1 > >> envi_file_query, file_fid, dims=file_dims, ns=file_ns, nl=file_nl, >> nb=file_nb >> file_dims = [-1L,0,file_ns-1,0,file_nl-1] >> file_mapinfo = envi_get_map_info(fid=file_fid) >> print, file_mapinfo >> pos = lindgen(file_nb) >> out_namea = HKMfiles[j]+'subset.img' >> file_mapinfo = envi_get_map_i…
creator: negra
date: 2008-03-28T15:30:05-00:00

Re: problem with subset one image by another
type: item
description: negra wrote: > On 27 О©╫О©╫О©╫, 21:56, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca> wrote: >> negra wrote: >>>> Without more details about what you want to do it is difficult, >>>> bordering upon impossible, for us to give you any useful advice about >>>> how to do it. >>> here is idl routine what I written. The beginning of it, is working. >>> pro spat_subset >>> cd, 'C:\Scandata\L1a' >>> HKMfiles = FILE_SEARCH('MOD02HKM.*.img',count=numfiles) >>> PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img')) >>> print, FILE_SEARCH(HKMfiles) >>> for j=0,numfiles-1 DO BEGIN >>> HKM_name = HKMfiles[j] >>> print,HKM_name >>> ;first restore all base save files >>> ; >>> envi, /restore_base_save_files >>> ; >>> ;Initialize ENVI and send all errors and warnings to the file >>> batch.txt >>> ; >>> envi_batch_init, log_file='batch.txt' >>> ; >>> ;Open the input files >>> ;kz_hkm mask file >>> envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=file1_fid >>> if (file1_fid eq -1) then begin >>> envi_batch_exit >>> return >>> endif >>> envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=file_fid >>> if (file_fid eq -1) then begin >>> envi_batch_exit >>> return >>> endif >>> envi_file_query, file1_fid, dims=file1_dims, ns=file1_ns, nl=file1_nl, >>> nb=file1_nb >>> file1_dims = [-1L,0,file1_ns-1,0,file1_nl-1] >>> file1_mapinfo = envi_get_map_info(fid=file1_fid) >>> print, file1_mapinfo >>> file1_xf = [0,file1_ns-1] >>> file1_yf = [0,file1_nl-1] >>> envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf, >>> file1_xmap, file1_ymap, /to_map >>> print, 'UL corner:',file1_xmap[0],file1_ymap[0] >>> print, 'LR corner:',file1_xmap[1],file1_ymap[1] >>> ;Longitude 44.39011111 - 88.38219444 >>> ;Latitude 36.20264722 - 56.35832500 >>> ;subset #1 >>> envi_file_query, file_fid, dims=file_dims, ns=file_ns, nl=file_nl, >>> nb=file_nb >>> file_dims = [-1L,0,file_ns-1,0,file_nl-1] >>> file_mapinfo = envi_get_map_info(fid=file_fid) >>> print, file_mapinfo >>> pos = lindgen(file_nb) >…
creator: Jean H.
date: 2008-03-28T16:22:13-00:00

Re: problem with subset one image by another
type: item
description: On 28 мар, 22:22, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca> wrote: > negra wrote: >> On 27 ÍÁÒ, 21:56, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca> wrote: >>> negra wrote: >>>> > Without more details about what you want to do it is difficult, >>>> > bordering upon impossible, for us to give you any useful advice about >>>> > how to do it. >>>> here is idl routine what I written. The beginning of it, is working. >>>> pro spat_subset >>>> cd, 'C:\Scandata\L1a' >>>> HKMfiles = FILE_SEARCH('MOD02HKM.*.img',count=numfiles) >>>> PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img')) >>>> print, FILE_SEARCH(HKMfiles) >>>> for j=0,numfiles-1 DO BEGIN >>>> HKM_name = HKMfiles[j] >>>> print,HKM_name >>>> ;first restore all base save files >>>> ; >>>> envi, /restore_base_save_files >>>> ; >>>> ;Initialize ENVI and send all errors and warnings to the file >>>> batch.txt >>>> ; >>>> envi_batch_init, log_file='batch.txt' >>>> ; >>>> ;Open the input files >>>> ;kz_hkm mask file >>>> envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=file1_fid >>>> if (file1_fid eq -1) then begin >>>> envi_batch_exit >>>> return >>>> endif >>>> envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=file_fid >>>> if (file_fid eq -1) then begin >>>> envi_batch_exit >>>> return >>>> endif >>>> envi_file_query, file1_fid, dims=file1_dims, ns=file1_ns, nl=file1_nl, >>>> nb=file1_nb >>>> file1_dims = [-1L,0,file1_ns-1,0,file1_nl-1] >>>> file1_mapinfo = envi_get_map_info(fid=file1_fid) >>>> print, file1_mapinfo >>>> file1_xf = [0,file1_ns-1] >>>> file1_yf = [0,file1_nl-1] >>>> envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf, >>>> file1_xmap, file1_ymap, /to_map >>>> print, 'UL corner:',file1_xmap[0],file1_ymap[0] >>>> print, 'LR corner:',file1_xmap[1],file1_ymap[1] >>>> ;Longitude 44.39011111 - 88.38219444 >>>> ;Latitude 36.20264722 - 56.35832500 >>>> ;subset #1 >>>> envi_file_query, file_fid, dims=file_dims, ns=file_ns, nl=file_nl, >>>> nb=file_nb >>>> file_dims = [-1L,0,file…
creator: negra
date: 2008-03-29T01:54:37-00:00

Re: problem with subset one image by another
type: item
description: On Mar 28, 8:54 pm, negra <chem...@mail.ru> wrote: > On 28 мар, 22:22, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca> wrote: > > > > > >> negra wrote: >>> On 27 ÍÁÒ, 21:56, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca> wrote: >>>> negra wrote: >>>> >> Without more details about what you want to do it is difficult, >>>> >> bordering upon impossible, for us to give you any useful advice about >>>> >> how to do it. >>>> > here is idl routine what I written. The beginning of it, is working. >>>> > pro spat_subset >>>> > cd, 'C:\Scandata\L1a' >>>> > HKMfiles = FILE_SEARCH('MOD02HKM.*.img',count=numfiles) >>>> > PRINT, '# NDSI files:',N_ELEMENTS(FILE_SEARCH('MOD02HKM.*.img')) >>>> > print, FILE_SEARCH(HKMfiles) >>>> > for j=0,numfiles-1 DO BEGIN >>>> > HKM_name = HKMfiles[j] >>>> > print,HKM_name >>>> > ;first restore all base save files >>>> > ; >>>> > envi, /restore_base_save_files >>>> > ; >>>> > ;Initialize ENVI and send all errors and warnings to the file >>>> > batch.txt >>>> > ; >>>> > envi_batch_init, log_file='batch.txt' >>>> > ; >>>> > ;Open the input files >>>> > ;kz_hkm mask file >>>> > envi_open_file, 'C:\Scandata\L1A\mask\kz_hkm', r_fid=file1_fid >>>> > if (file1_fid eq -1) then begin >>>> > envi_batch_exit >>>> > return >>>> > endif >>>> > envi_open_file,'C:\Scandata\L1A\'+ HKMfiles[j], r_fid=file_fid >>>> > if (file_fid eq -1) then begin >>>> > envi_batch_exit >>>> > return >>>> > endif >>>> > envi_file_query, file1_fid, dims=file1_dims, ns=file1_ns, nl=file1_nl, >>>> > nb=file1_nb >>>> > file1_dims = [-1L,0,file1_ns-1,0,file1_nl-1] >>>> > file1_mapinfo = envi_get_map_info(fid=file1_fid) >>>> > print, file1_mapinfo >>>> > file1_xf = [0,file1_ns-1] >>>> > file1_yf = [0,file1_nl-1] >>>> > envi_convert_file_coordinates, file1_fid, file1_xf, file1_yf, >>>> > file1_xmap, file1_ymap, /to_map >>>> > print, 'UL corner:',file1_xmap[0],file1_ymap[0] >>>> > print, 'LR corner:',file1_xmap[1],file1_ymap[1] >>>> > ;Longitude 44.39011111 - 88.38219444 >>>> > ;Latitude 36.…
creator: Wasit.Weather
date: 2008-03-29T04:18:27-00:00

Re: problem with subset one image by another
type: item
description: > I tried to do as you suggested, but it was unsuccessful. > May be it must look like this? > min_x = max(file1_xmap[0], file_xmap[0]); Attempt to store into an > expression: <DOUBLE ( 63.295452)>. look at the help file for "max". You must give it an array of values... the 2nd argument is a variable name that will contain the index of the max value... so try max([var1,var2]) You will want to round the coordinates properly as well! Jean > > Gulshat
creator: Jean H.
date: 2008-03-31T17:05:21-00:00

Re: problem with subset one image by another
type: item
description: negra wrote: ... > max_x = min(file1_xmap[1], file_xmap[1]) > min_y = max(file1_ymap[0], file_ymap[0]) > max_y = min(file1_ymap[1], file_ymap[1]) As Jean has already pointed out, you'd have to organize things differently to use MAX() and MIN() here. However, it's far simpler to avoid MAX() and MIN() altogether. max_x = file1_xmap[1] < file_xmap[1] min_y = file1_ymap[0] > file_ymap[0] max_y = file1_ymap[1] < file_ymap[1] It all looks pretty confusing if you're used to a language (there are quite a few) where '<' and '>' are comparison operators, but in IDL the corresponding comparison operators are called 'lt' and 'gt'. The '<' and '>' operators return the minimum and maximum, respectively, of their operands.
creator: jameskuyper
date: 2008-04-01T11:18:11-00:00

Re: problem with subset one image by another
type: item
description: I want to say thanks to all who tried to help me. All has turned out.
creator: negra
date: 2008-04-04T15:32:13-00:00

Re: problem with subset one image by another
type: item
description: On Apr 4, 10:32 am, negra <chem...@mail.ru> wrote: > I want to say thanks to all who tried to help me. All has turned out. Can you share the whole PRO...END program here. Or send me by email. Actually, that is what I am trying to work it out now. email: wasit.weather@gmail.com
creator: Wasit.Weather
date: 2008-04-04T15:54:45-00:00