ropensci / MODIStsp

An "R" package for automatic download and preprocessing of MODIS Land Products Time Series
https://docs.ropensci.org/MODIStsp
GNU General Public License v3.0
155 stars 51 forks source link

Issues with time series RDATA computing #222

Closed rcoura54 closed 3 years ago

rcoura54 commented 3 years ago

Dear collaborators,

I am facing some issues with RTS computing using the MODIStsp GUI.

Once everything is download, I only have access to ENVI rts (.dat/.hdf), although R ones are well specified in the options.

Maybe there is a way to convert the ENVI RTS (.dat) to R raster time series (.Rdata)?

Otherwise I will have to create the RTS my self, specifying raster periodicity using lubridate etc etc ect....

Here are the JSONs of the two requests :

1- { "selcat": "Ecosystem Variables - Vegetation Indices", "selprod": "Vegetation Indexes_16Days_250m (M*D13Q1)", "prod_version": "6", "sensor": "Terra", "bandsel": ["NDVI", "EVI"], "quality_bandsel": "QA_aer", "indexes_bandsel": null, "download_server": "http", "user": "~", "password": "~~~~", "downloader": "http", "download_range": "Full", "start_date": "2000.01.01", "end_date": "2020.11.24", "spatmeth": "file", "start_x": 18, "end_x": 18, "start_y": 7, "end_y": 7, "bbox": [null, null, null, null], "spafile": "///Datasets/clip_extent_L4/clip_extent_L4.shp", "drawnext": null, "out_projsel": "Native", "output_proj": "MODIS Sinusoidal", "out_res_sel": "Native", "out_res": "231.656358", "resampling": "near", "reprocess": false, "delete_hdf": true, "nodata_change": false, "scale_val": true, "out_format": "GTiff", "ts_format": ["R RasterStack", "GDAL VRT", "ENVI Meta Files"], "compress": "LZW", "out_folder": "///Datasets/MODIS/MOD13Q1V6/MODtsp", "out_folder_mod": "///Datasets/MODIS/MOD13Q1V6/QA", "MODIStspVersion": "2.0.4" }

2- { "selcat": "Ecosystem Variables - LAI/FPAR", "selprod": "LAI_8Days_500m (MCD15A2H)", "prod_version": "6", "sensor": "Terra", "bandsel": ["Fpar", "Lai"], "quality_bandsel": null, "indexes_bandsel": null, "download_server": "http", "user": "~~~", "password": "~~~", "downloader": "http", "download_range": "Full", "start_date": "2000.01.01", "end_date": "2020.11.24", "spatmeth": "file", "start_x": 18, "end_x": 18, "start_y": 7, "end_y": 7, "bbox": [null, null, null, null], "spafile": "///Datasets/clip_extent_L4/clip_extent_L4.shp", "drawnext": null, "out_projsel": "Native", "output_proj": "MODIS Sinusoidal", "out_res_sel": "Native", "out_res": "463.3127", "resampling": "near", "reprocess": false, "delete_hdf": true, "nodata_change": false, "scale_val": true, "out_format": "GTiff", "ts_format": ["R RasterStack", "GDAL VRT", "ENVI Meta Files"], "compress": "LZW", "out_folder": "///Datasets/VNP15A2/MODtsp", "out_folder_mod": "///Datasets/VNP15A2/Fpar_6933", "MODIStspVersion": "2.0.4" }

Thanks for reading, Romain

Originally posted by @rcoura54 in https://github.com/ropensci/MODIStsp/issues/162#issuecomment-733798430

ranghetti commented 3 years ago

Can you please provide the file ///Datasets/clip_extent_L4/clip_extent_L4.shp (together witd associated Shapefiles's files)?

rcoura54 commented 3 years ago

Here we are.

SCR is EPSG:6933

It would be due to that/overlapping SCRs?

I was'nt sure since MODIStsp' GUI appeared to recognize the SHP in the webmapping.

Thanks, Romain

Le ven. 27 nov. 2020 à 11:47, Luigi Ranghetti notifications@github.com a écrit :

Can you please provide the file ///Datasets/clip_extent_L4/clip_extent_L4.shp (together witd associated Shapefiles's files)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/MODIStsp/issues/222#issuecomment-734772213, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEFH6LDZMEABBWTJBXYKB3SR57SVANCNFSM4UCUPKPA .

-- Dr. Romain Courault Postdoctoral Researcher IRD - Délégation Régionale Occitanie UMR Espace DEV, Maison de la Télédétection - Montpellier Groupe de Recherche Arctique (CNRS Meudon)

ranghetti commented 3 years ago

I have not understood your answer: I was asking you to attach that shapefile so to try reproducing the error.

rcoura54 commented 3 years ago

Spiacenti, ho inserito l'SHP direttamente in risposta dal mio indirizzo email. Eccolo tramite GitHub. Ho detto: pottrebe esse dovuto al sistema di coordinate (sinusoidale per MODIS vs WGS84 o altro per SHP?). Tuttavia l'interfaccia grafica MODIStsp ha riconosciuto l'estensione geografica del SHP importato.
Grazie mólto (GoogleTranslate Français => Italiano, mi dispacie)

Sorry, I just directly insert my SHP in the mail response. Here it is. I was saying: maybe the problem is due to the coordinate system? (sinusoidal for MODIS vs WGS84 or another for SHP?). However the MODIStsp graphical interface recognized the geographical extension of the SHP I imported. Thanks a lot, Romain clip_extent_L4.zip clip_extent_L4.zip

ranghetti commented 3 years ago

The problem was due to the fact that "GDAL VRT" was written in uppercase in the json parameter file, instead than "GDAL vrt". Actually the documentation was quite messy about this parameter (sometimes "GDAL VRT" was specified, sometimes "GDAL vrt files"). Now I have fixed the code to accept both the possibilities: try to reinstall the package from GitHub with the code below and let me know.

install.packages("remotes")
remotes::install_github("ropensci/MODIStsp")
rcoura54 commented 3 years ago

Thanks a lot, grazie!

Does that mean I have to redownload all my datasets?!

OK, I will tell you if it works.

Le mar. 1 déc. 2020 à 10:43, Luigi Ranghetti notifications@github.com a écrit :

Reopened #222 https://github.com/ropensci/MODIStsp/issues/222.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/MODIStsp/issues/222#event-4056136701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEFH6NFKYYVSFQZ3ZEKEQLSSS3FPANCNFSM4UCUPKPA .

-- Dr. Romain Courault Postdoctoral Researcher IRD - Délégation Régionale Occitanie UMR Espace DEV, Maison de la Télédétection - Montpellier Groupe de Recherche Arctique (CNRS Meudon)

rcoura54 commented 3 years ago

Dear Luigi,

It works, Rdata time serie are available/done as post-processing after the re-installation of MODIStsp (the same for GDAL VRT).

How have you done that? (I'm curious about the code behind the RTS processing specific to MODIStsp)

Thanks a lot,

Le mar. 1 déc. 2020 à 16:49, Romain Courault romain.courault@ird.fr a écrit :

Thanks a lot, grazie!

Does that mean I have to redownload all my datasets?!

OK, I will tell you if it works.

Le mar. 1 déc. 2020 à 10:43, Luigi Ranghetti notifications@github.com a écrit :

Reopened #222 https://github.com/ropensci/MODIStsp/issues/222.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/MODIStsp/issues/222#event-4056136701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEFH6NFKYYVSFQZ3ZEKEQLSSS3FPANCNFSM4UCUPKPA .

-- Dr. Romain Courault Postdoctoral Researcher IRD - Délégation Régionale Occitanie UMR Espace DEV, Maison de la Télédétection - Montpellier Groupe de Recherche Arctique (CNRS Meudon)

-- Dr. Romain Courault Postdoctoral Researcher IRD - Délégation Régionale Occitanie UMR Espace DEV, Maison de la Télédétection - Montpellier Groupe de Recherche Arctique (CNRS Meudon)

ranghetti commented 3 years ago

The code for the generation of raster time series is in function MODIStsp_vrt_create.R. In particular, the two chunks below produce respectively GDAL vrt files and raster time series.

https://github.com/ropensci/MODIStsp/blob/336821a0ae680a8c0caddc0608918779376764dc/R/MODIStsp_vrt_create.R#L252-L276 https://github.com/ropensci/MODIStsp/blob/336821a0ae680a8c0caddc0608918779376764dc/R/MODIStsp_vrt_create.R#L281-L310