:-( still persists !!!
may be I will try on linux machine to get some luck

On 1/26/2012 3:53 PM, Matteo Mattiuzzi wrote:
> ok should be simple...remove the space in: "c:/new aster" and try again
>
> >>> Vikram Ranga <babuaw...@gmail.com> 1/26/2012 3:45 pm >>>
> OK I tried this,
> sds<-getSDS(HdfName="H:/new 
> aster/AST_09_00304012003053127_20120124074826_13837.hdf")
> Warning message:
> running command 'C:\Windows\system32\cmd.exe /c gdalinfo H:/new 
> aster/AST_09_00304012003053127_20120124074826_13837.hdf' had status 1
>  but It is still returning NULL values...
> >sds
> $SDSnames
> NULL
>
> $SDS4gdal
> NULL
>
>
>
> On 1/26/2012 3:25 PM, Matteo Mattiuzzi wrote:
>> Ok, I piked a ASTEfile: 
>> ftp://e4ftl01.cr.usgs.gov/ASTER_B/ASTT/AST_L1B.003/2000.03.30/AST_L1B_00303302000172133_20110111233757_1859.hdf
>> # I am working on a Linux system I hope it does the same on Windows!!
>> install.packages("MODIS", repos="http://R-Forge.R-project.org";, 
>> dependencies=TRUE)
>> library(MODIS)
>> sds <- getSDS(HdfName= 
>> "/your/path/to/AST_L1B_00303302000172133_20110111233757_1859.hdf")
>> SDS$SDS4gdal
>>  [1] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData1"
>>  
>>
>>  [2] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData2"
>>  
>>
>>  [3] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData3N"
>>  [4] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData3B"
>>  [5] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData4"
>>  
>>
>>  [6] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData5"
>>  
>>
>>  [7] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData6"
>>  
>>
>>  [8] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData7"
>>  
>>
>>  [9] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData8"
>>  
>>
>> [10] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData9"
>>  
>>
>> [11] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData10"
>>  
>>
>> [12] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData11"
>>  
>>
>> [13] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData12"
>>  
>>
>> [14] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData13"
>>  
>>
>> [15] 
>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData14"
>>  
>>
>> [16] 
>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":0"
>>  
>>
>> [17] 
>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":1"
>>  
>>
>> [18] 
>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":2"
>>  
>>
>> [19] 
>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":3"
>>  
>>
>> [20] 
>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":4"
>>  
>>
>> [21] 
>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":5"
>>  
>>
>> ...
>> f1 <- raster(SDS$SDS4gdal[1])
>> Geospatial Data Abstraction Library extensions to R successfully loaded
>> Loaded GDAL runtime: GDAL 1.8.0, released 2011/01/12
>> Path to GDAL shared files: /usr/share/gdal/1.8
>> Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
>> Path to PROJ.4 shared files: (autodetected)
>> Warning messages:
>> 1: In normalizePath(x) :
>>   
>> path[1]="HDF4_EOS:EOS_SWATH:"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf":VNIR_Swath:ImageData1":
>>  
>> No such file or directory
>> 2: In .rasterFromGDAL(x, band = band, objecttype, ...) :
>>   GeoTransform values not available; georeferencing will not be correct
>> > f1
>> class       : RasterLayer
>> dimensions  : 4200, 4980, 20916000  (nrow, ncol, ncell)
>> resolution  : 1, 1  (x, y)
>> extent      : 0, 4980, 0, 4200  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> values      : 
>> HDF4_EOS:EOS_SWATH:"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf":VNIR_Swath:ImageData1
>>  
>>
>> min value   : 0
>> max value   : 255
>> # or
>> f2 <-stack(SDS$SDS4gdal[1:3])
>> warning messages...
>> > f2
>> class       : RasterStack
>> dimensions  : 4200, 4980, 20916000, 3  (nrow, ncol, ncell, nlayers)
>> resolution  : 1, 1  (x, y)
>> extent      : 0, 4980, 0, 4200  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> min values  : 0 0 0
>> max values  : 255 255 255
>> The file I have downloaded is a Swath product.... Spatial reference 
>> is lost and the data is NOT a GRIDDED file (Pixels are not squared 
>> but more polygons of different size). So you can't do many things you 
>> could do with an GRID File! ...Maybe you send me a link to download 
>> the file you are using (if you use d different type!)
>> Matteo
>>
>> >>> Vikram Ranga <babuaw...@gmail.com> 1/26/2012 2:55 pm >>>
>> Hi Matteo,
>> I am not sure about ASTER is HDF4 or HDF5.
>> The codes you have given me I tried them
>> sdsRaw <- shell(paste("gdalinfo ", HdfName,sep=""),intern=TRUE); this 
>> command seems to be working fine giving "Operable program or batch 
>> file ". And with raster(sdsRaw[1]) giving error : object 'SDSRaw' not 
>> found!
>> While the another two codes does not seems to have worked
>> SDSnames <- grep(x=sdsRaw,pattern="SUBDATASET_*.._NAME",value=T)
>> The return with this command is character (0)
>> SDSnames <- unlist(lapply(SDSnames,function(x) strsplit(x,"=")[[1]][2]))
>> while with this one; the output is NULL.
>>
>> Though, I tried to install MODIS library to try getSDS() but could 
>> not find it in the library(strangely)
>>
>> Regards,
>>
>> Vikram.
>>
>> On 1/26/2012 11:29 AM, Matteo Mattiuzzi wrote:
>>> Hi Vikram,
>>>
>>> Isn't Aster HDF not  an HDF4 format (like MODIS)? HDF4 and HDF5 are 
>>> not really comparable/compatible each to other.
>>>
>>> If I'm right, you can open the file using GDAL, or even with the 
>>> raster package, but you have to point the path to the layer (SDS) 
>>> and not only to the file. There was a discussion between Robert 
>>> Hijmans and Jan Verbesselt about that... 
>>> https://r-forge.r-project.org/forum/message.php?msg_id=4132&group_id=294
>>>
>>> I think you can do the same with ASTER data.
>>>
>>> So now the only problem should be how to get the path to the SDS:
>>> in the MODIS package we use the function: 
>>> getSDS(HdfName,method='gdal') , try to insert the full FILE-path in 
>>> that function.
>>> Or you can try (on windows) with:
>>> sdsRaw <- shell(paste("gdalinfo ", HdfName,sep=""),intern=TRUE)
>>> SDSnames <- grep(x=sdsRaw,pattern="SUBDATASET_*.._NAME",value=T)
>>> SDSnames <- unlist(lapply(SDSnames,function(x) 
>>> strsplit(x,"=")[[1]][2]))
>>>
>>> at least the sdsRaw should work...SDSnames I don't know, just test 
>>> it (and maybe give me a short feedback)
>>>
>>> If everything runs fine you should be able to open in then raster 
>>> package like that:
>>>
>>> SDS1 <-raster(SDSnames[1]) # you can ignore the warning: 
>>> normalizePath(x)
>>> or
>>> sds250 <- stack(SDSnames[1:2]) # FOR MODIS! (only layers with the 
>>> same resolution are 'stackable')
>>> ....
>>>
>>> Matteo
>>>
>>>
>>> So first you have to determinatate the full path to the SDS you wand 
>>> to extract.
>>>
>>> >>> Vikram Ranga <babuaw...@gmail.com> 26.01.12 10.20 Uhr >>>
>>> Hello Paul,
>>> sorry for abstruse mail. I am using R version 2.13.2 on windows (64
>>> bit). I am trying to open ASTER data files(*.hdf). Though, I tried few
>>> things like readGDAL() and raster() but got error message
>>> "53127_20120124074826_13837.hdf' not recognised as a supported file
>>> format" . I tried to load hdf5 package but while installing it I got
>>> Warning message:
>>> In getDependencies(pkgs, dependencies, available, lib) : package 'hdf5'
>>> is not available (for R version 2.13.2). I saw the discussion on hdf
>>> file on the list with topic "*What is the latest re: reading HDF files
>>> with R*". In the discussion Roger pointed out that building gdal
>>> against hdf format might help but I do not have a clue how to do that.
>>> let me know if you want more info from my end.
>>>
>>>
>>> Regards,
>>>
>>> Vikram.
>>>
>>> On 1/26/2012 10:01 AM, Paul Hiemstra wrote:
>>> > On 01/26/2012 08:53 AM, Vikram Ranga wrote:
>>> >> Hello List,
>>> >> I was trying to open HDF format files.
>>> >> Though I have followed the discussion on HDF5 format but really cant
>>> >> figure out as I tried to convert HDF to Geotiff but the tool is not
>>> >> working on my system. As the package is not for windows my 
>>> options are
>>> >> very limited. Can anyone suggest me on this?
>>> >>
>>> >>
>>> >> Regards,
>>> >>
>>> >> Vikram.
>>> >>
>>> >> _______________________________________________
>>> >> R-sig-Geo mailing list
>>> >> R-sig-Geo@r-project.org
>>> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> > Hi Vikram,
>>> >
>>> > You e-mail is much too vague to yield a good answer. A few questions
>>> > come to mind:
>>> >
>>> > - What is the structure of your HDF files
>>> > - What "discussion on hdf5 format" do you mean? And where can we find
>>> > it? It is best to give a summary in your mail what you took out of 
>>> this
>>> > discussion.
>>> > - Show us concretely what you did (code, package etc). What R code
>>> > failed to load your HDF file, what was the error message it yielded?
>>> > - What version of R are you using, which package are you using to read
>>> > the HDF file, what are the versions of those packages. This can be
>>> > easily provided using the sessionInfo() command.
>>> >
>>> > Give us more to work with, or it will be very hard to help you.
>>> >
>>> > regards,
>>> > Paul
>>> >
>>>
>>>     [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to