gdal_translate in R changing the cell resolution of extracted subdataset from HDF The Next CEO of Stack OverflowHow to extract subdataset from HDF raster?GDAL 2.0.1/QGIS 2.14.0 on OSX won't open MODIS HDF?Recommendation for getting TIF raster from modis HDF, for processing in Rsmoothing raster layer stack using RConvert MODIS HDF file in sinusoidal projection into GeoTiff withR-Studio0.99, How to compute correlation between two rasters and serial correlationOpen HDF4 Files using GDAL on WindowsIterating and extracting subdatasets from hdf files and exporting data into MS excel using ModelBuilder?Issue with gdalUtils vs. raster in gridding data in RIssue running GDAL_Translate on Redhat PPC64

How seriously should I take size and weight limits of hand luggage?

My boss doesn't want me to have a side project

Does int main() need a declaration on C++?

How dangerous is XSS

Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico

Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?

Man transported from Alternate World into ours by a Neutrino Detector

Is it possible to make a 9x9 table fit within the default margins?

Is there a rule of thumb for determining the amount one should accept for a settlement offer?

Another proof that dividing by 0 does not exist -- is it right?

Is it correct to say moon starry nights?

Strange use of "whether ... than ..." in official text

Salesforce opportunity stages

Are British MPs missing the point, with these 'Indicative Votes'?

Could a dragon use its wings to swim?

How can a day be of 24 hours?

Read/write a pipe-delimited file line by line with some simple text manipulation

Cannot restore registry to default in Windows 10?

Does Germany produce more waste than the US?

What difference does it make matching a word with/without a trailing whitespace?

How to implement Comparable so it is consistent with identity-equality

Can a PhD from a non-TU9 German university become a professor in a TU9 university?

How to find if SQL server backup is encrypted with TDE without restoring the backup

How exploitable/balanced is this homebrew spell: Spell Permanency?



gdal_translate in R changing the cell resolution of extracted subdataset from HDF



The Next CEO of Stack OverflowHow to extract subdataset from HDF raster?GDAL 2.0.1/QGIS 2.14.0 on OSX won't open MODIS HDF?Recommendation for getting TIF raster from modis HDF, for processing in Rsmoothing raster layer stack using RConvert MODIS HDF file in sinusoidal projection into GeoTiff withR-Studio0.99, How to compute correlation between two rasters and serial correlationOpen HDF4 Files using GDAL on WindowsIterating and extracting subdatasets from hdf files and exporting data into MS excel using ModelBuilder?Issue with gdalUtils vs. raster in gridding data in RIssue running GDAL_Translate on Redhat PPC64










0















I'm trying to extract subdataset from MODIS LST HDFs using following code.



library(gdalUtils)
HDF_list = list.files(path, pattern= "\.hdf$", all.files=FALSE, full.names=TRUE,recursive=FALSE)
gdal_translate(get_subdatasets(HDF_list[1])[5], dst_dataset = "sds4.tif")


But the Output raster (sds4.tif) is having different cellsize [929.378147, 907]. [926.6254331, 926.6254331] is the original cellsize of HDF file.










share|improve this question














bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Not sure we can test this without at least one sample HDF - where are you getting them from? Can you share one?

    – Spacedman
    Feb 28 at 10:35











  • Sample File: drive.google.com/file/d/1ZQqF8IHds8uxHqevxTee4JQmZ8I3rOpU/…

    – Ritesh Porwal
    Feb 28 at 10:44











  • Use gdal_translate with the -tr parameter

    – user30184
    Feb 28 at 11:40











  • i have already used -tr parameter but didn't work.

    – Ritesh Porwal
    Feb 28 at 11:58















0















I'm trying to extract subdataset from MODIS LST HDFs using following code.



library(gdalUtils)
HDF_list = list.files(path, pattern= "\.hdf$", all.files=FALSE, full.names=TRUE,recursive=FALSE)
gdal_translate(get_subdatasets(HDF_list[1])[5], dst_dataset = "sds4.tif")


But the Output raster (sds4.tif) is having different cellsize [929.378147, 907]. [926.6254331, 926.6254331] is the original cellsize of HDF file.










share|improve this question














bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Not sure we can test this without at least one sample HDF - where are you getting them from? Can you share one?

    – Spacedman
    Feb 28 at 10:35











  • Sample File: drive.google.com/file/d/1ZQqF8IHds8uxHqevxTee4JQmZ8I3rOpU/…

    – Ritesh Porwal
    Feb 28 at 10:44











  • Use gdal_translate with the -tr parameter

    – user30184
    Feb 28 at 11:40











  • i have already used -tr parameter but didn't work.

    – Ritesh Porwal
    Feb 28 at 11:58













0












0








0








I'm trying to extract subdataset from MODIS LST HDFs using following code.



library(gdalUtils)
HDF_list = list.files(path, pattern= "\.hdf$", all.files=FALSE, full.names=TRUE,recursive=FALSE)
gdal_translate(get_subdatasets(HDF_list[1])[5], dst_dataset = "sds4.tif")


But the Output raster (sds4.tif) is having different cellsize [929.378147, 907]. [926.6254331, 926.6254331] is the original cellsize of HDF file.










share|improve this question














I'm trying to extract subdataset from MODIS LST HDFs using following code.



library(gdalUtils)
HDF_list = list.files(path, pattern= "\.hdf$", all.files=FALSE, full.names=TRUE,recursive=FALSE)
gdal_translate(get_subdatasets(HDF_list[1])[5], dst_dataset = "sds4.tif")


But the Output raster (sds4.tif) is having different cellsize [929.378147, 907]. [926.6254331, 926.6254331] is the original cellsize of HDF file.







gdal r hdf gdalutils






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 28 at 9:31









Ritesh PorwalRitesh Porwal

487




487





bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Not sure we can test this without at least one sample HDF - where are you getting them from? Can you share one?

    – Spacedman
    Feb 28 at 10:35











  • Sample File: drive.google.com/file/d/1ZQqF8IHds8uxHqevxTee4JQmZ8I3rOpU/…

    – Ritesh Porwal
    Feb 28 at 10:44











  • Use gdal_translate with the -tr parameter

    – user30184
    Feb 28 at 11:40











  • i have already used -tr parameter but didn't work.

    – Ritesh Porwal
    Feb 28 at 11:58

















  • Not sure we can test this without at least one sample HDF - where are you getting them from? Can you share one?

    – Spacedman
    Feb 28 at 10:35











  • Sample File: drive.google.com/file/d/1ZQqF8IHds8uxHqevxTee4JQmZ8I3rOpU/…

    – Ritesh Porwal
    Feb 28 at 10:44











  • Use gdal_translate with the -tr parameter

    – user30184
    Feb 28 at 11:40











  • i have already used -tr parameter but didn't work.

    – Ritesh Porwal
    Feb 28 at 11:58
















Not sure we can test this without at least one sample HDF - where are you getting them from? Can you share one?

– Spacedman
Feb 28 at 10:35





Not sure we can test this without at least one sample HDF - where are you getting them from? Can you share one?

– Spacedman
Feb 28 at 10:35













Sample File: drive.google.com/file/d/1ZQqF8IHds8uxHqevxTee4JQmZ8I3rOpU/…

– Ritesh Porwal
Feb 28 at 10:44





Sample File: drive.google.com/file/d/1ZQqF8IHds8uxHqevxTee4JQmZ8I3rOpU/…

– Ritesh Porwal
Feb 28 at 10:44













Use gdal_translate with the -tr parameter

– user30184
Feb 28 at 11:40





Use gdal_translate with the -tr parameter

– user30184
Feb 28 at 11:40













i have already used -tr parameter but didn't work.

– Ritesh Porwal
Feb 28 at 11:58





i have already used -tr parameter but didn't work.

– Ritesh Porwal
Feb 28 at 11:58










1 Answer
1






active

oldest

votes


















0














The HDF metadata has:



 UpperLeftPointMtrs=(7783653.638366,3335851.559300)
LowerRightMtrs=(8895604.158132,2223901.039533)


and the grids are 1200x1200. That gives a cell size of:



> (7783653.638366-8895604.158132)/1200
[1] -926.6254
> (3335851.559300 - 2223901.039533)/1200
[1] 926.6254
>


Converting band 5 of your test file gets me:



> path = "MOD11A1.A2008005.h25v06.006.2015337154719.hdf"
> gdal_translate(get_subdatasets(path)[5], dst_dataset="band5.tif")
NULL
> b5 = raster("./band5.tif")
> b5
class : RasterLayer
dimensions : 1200, 1200, 1440000 (nrow, ncol, ncell)
resolution : 926.6254, 926.6254 (x, y)
extent : 7783654, 8895604, 2223901, 3335852 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs
data source : /nobackup/rowlings/Downloads/band5.tif
names : band5
values : 0, 65535 (min, max)


a raster with exactly those resolutions. So I can't duplicate your error.






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "79"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313869%2fgdal-translate-in-r-changing-the-cell-resolution-of-extracted-subdataset-from-hd%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The HDF metadata has:



     UpperLeftPointMtrs=(7783653.638366,3335851.559300)
    LowerRightMtrs=(8895604.158132,2223901.039533)


    and the grids are 1200x1200. That gives a cell size of:



    > (7783653.638366-8895604.158132)/1200
    [1] -926.6254
    > (3335851.559300 - 2223901.039533)/1200
    [1] 926.6254
    >


    Converting band 5 of your test file gets me:



    > path = "MOD11A1.A2008005.h25v06.006.2015337154719.hdf"
    > gdal_translate(get_subdatasets(path)[5], dst_dataset="band5.tif")
    NULL
    > b5 = raster("./band5.tif")
    > b5
    class : RasterLayer
    dimensions : 1200, 1200, 1440000 (nrow, ncol, ncell)
    resolution : 926.6254, 926.6254 (x, y)
    extent : 7783654, 8895604, 2223901, 3335852 (xmin, xmax, ymin, ymax)
    coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs
    data source : /nobackup/rowlings/Downloads/band5.tif
    names : band5
    values : 0, 65535 (min, max)


    a raster with exactly those resolutions. So I can't duplicate your error.






    share|improve this answer



























      0














      The HDF metadata has:



       UpperLeftPointMtrs=(7783653.638366,3335851.559300)
      LowerRightMtrs=(8895604.158132,2223901.039533)


      and the grids are 1200x1200. That gives a cell size of:



      > (7783653.638366-8895604.158132)/1200
      [1] -926.6254
      > (3335851.559300 - 2223901.039533)/1200
      [1] 926.6254
      >


      Converting band 5 of your test file gets me:



      > path = "MOD11A1.A2008005.h25v06.006.2015337154719.hdf"
      > gdal_translate(get_subdatasets(path)[5], dst_dataset="band5.tif")
      NULL
      > b5 = raster("./band5.tif")
      > b5
      class : RasterLayer
      dimensions : 1200, 1200, 1440000 (nrow, ncol, ncell)
      resolution : 926.6254, 926.6254 (x, y)
      extent : 7783654, 8895604, 2223901, 3335852 (xmin, xmax, ymin, ymax)
      coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs
      data source : /nobackup/rowlings/Downloads/band5.tif
      names : band5
      values : 0, 65535 (min, max)


      a raster with exactly those resolutions. So I can't duplicate your error.






      share|improve this answer

























        0












        0








        0







        The HDF metadata has:



         UpperLeftPointMtrs=(7783653.638366,3335851.559300)
        LowerRightMtrs=(8895604.158132,2223901.039533)


        and the grids are 1200x1200. That gives a cell size of:



        > (7783653.638366-8895604.158132)/1200
        [1] -926.6254
        > (3335851.559300 - 2223901.039533)/1200
        [1] 926.6254
        >


        Converting band 5 of your test file gets me:



        > path = "MOD11A1.A2008005.h25v06.006.2015337154719.hdf"
        > gdal_translate(get_subdatasets(path)[5], dst_dataset="band5.tif")
        NULL
        > b5 = raster("./band5.tif")
        > b5
        class : RasterLayer
        dimensions : 1200, 1200, 1440000 (nrow, ncol, ncell)
        resolution : 926.6254, 926.6254 (x, y)
        extent : 7783654, 8895604, 2223901, 3335852 (xmin, xmax, ymin, ymax)
        coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs
        data source : /nobackup/rowlings/Downloads/band5.tif
        names : band5
        values : 0, 65535 (min, max)


        a raster with exactly those resolutions. So I can't duplicate your error.






        share|improve this answer













        The HDF metadata has:



         UpperLeftPointMtrs=(7783653.638366,3335851.559300)
        LowerRightMtrs=(8895604.158132,2223901.039533)


        and the grids are 1200x1200. That gives a cell size of:



        > (7783653.638366-8895604.158132)/1200
        [1] -926.6254
        > (3335851.559300 - 2223901.039533)/1200
        [1] 926.6254
        >


        Converting band 5 of your test file gets me:



        > path = "MOD11A1.A2008005.h25v06.006.2015337154719.hdf"
        > gdal_translate(get_subdatasets(path)[5], dst_dataset="band5.tif")
        NULL
        > b5 = raster("./band5.tif")
        > b5
        class : RasterLayer
        dimensions : 1200, 1200, 1440000 (nrow, ncol, ncell)
        resolution : 926.6254, 926.6254 (x, y)
        extent : 7783654, 8895604, 2223901, 3335852 (xmin, xmax, ymin, ymax)
        coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs
        data source : /nobackup/rowlings/Downloads/band5.tif
        names : band5
        values : 0, 65535 (min, max)


        a raster with exactly those resolutions. So I can't duplicate your error.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 28 at 12:21









        SpacedmanSpacedman

        24.7k23551




        24.7k23551



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313869%2fgdal-translate-in-r-changing-the-cell-resolution-of-extracted-subdataset-from-hd%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

            Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

            Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221