ImageFusion icon indicating copy to clipboard operation
ImageFusion copied to clipboard

ImageFusion install failed

Open TianyaImpression opened this issue 3 years ago • 1 comments

I tried to install the package, it failed. Can you help me? Thank you very much!

OS: win10 R: 4.2.1 image

TianyaImpression avatar Oct 31 '22 00:10 TianyaImpression

Hi, thanks for letting me know! The package had not yet been updated to work with R 4.2, Could you try again and let me know if it is fixed?

JohMast avatar Oct 31 '22 20:10 JohMast

Hi, thanks for letting me know! The package had not yet been updated to work with R 4.2, Could you try again and let me know if it is fixed?

Thank you for your update! The install seems ok, then I will try more. Thank you for your help! image

TianyaImpression avatar Nov 14 '22 05:11 TianyaImpression

I tried the test code, it failed. `# Load required libraries library(ImageFusion) library(raster)

Get filesnames of high resolution images

landsat <- list.files( system.file("landsat/filled", package = "ImageFusion"), ".tif", recursive = TRUE, full.names = TRUE )

Get filesnames of low resolution images

modis <- list.files( system.file("modis", package = "ImageFusion"), ".tif", recursive = TRUE, full.names = TRUE )

Create output directory in temporary folder

out_dir <- file.path(tempdir(),"Outputs") if(!dir.exists(out_dir)) dir.create(out_dir, recursive = TRUE)

Run the fusion on the entire time series

imagefusion_task(filenames_high = landsat, dates_high = c(68,77,93,100), filenames_low = modis, dates_low = 68:93, dates_pred = c(65,85,95), out_dir = out_dir)

remove the output directory

unlink(out_dir,recursive = TRUE)`

image

looking forward your reply, thank you!

TianyaImpression avatar Nov 15 '22 01:11 TianyaImpression

I tried to use the monthly synthesized GIMMS (1982-2015) and MODIS (2001-2021) NDVI data for data fusion, but failed. The code and error are as follows:

imagefusion_task( filenames_high = dir_high, dates_high = 229:480, #2001-2021逐月,参考alldates中的序号 filenames_low = dir_lowrs, dates_low = 1:408, #1982-2015年逐月 dates_pred = 1:408, out_dir = "./gimmsMonthMaxPredicted/", method = 'estarfm' ) image

TianyaImpression avatar Nov 15 '22 07:11 TianyaImpression

Hi, it seems that after the update, there are difficulties finding the proj library. Could you try running this code (preferably before loading any packages) and let me know if this changes things?

path_to_proj <- file.path(Sys.getenv("R_LIBS_USER"),"Imagefusion/proj")
Sys.setenv(PROJ_LIB=path_to_proj)

Thanks!

JohMast avatar Nov 15 '22 08:11 JohMast

Hi, it seems that after the update, there are difficulties finding the proj library. Could you try running this code (preferably before loading any packages) and let me know if this changes things?

path_to_proj <- file.path(Sys.getenv("R_LIBS_USER"),"Imagefusion/proj")
Sys.setenv(PROJ_LIB=path_to_proj)

Thanks!

image image

image

I runned that code,and then runned the test code, it still failed. Thank you!

TianyaImpression avatar Nov 16 '22 02:11 TianyaImpression

Thanks for the feedback! It would be interesting to know if there is actually a Data base File called "proj" (~8MB) under the path_to_proj. If so, then the issue is probably just some broken path which we can fix relatively easily. Could you please check if the file exists?

JohMast avatar Nov 16 '22 07:11 JohMast

Thanks for the feedback! It would be interesting to know if there is actually a Data base File called "proj" (~8MB) under the path_to_proj. If so, then the issue is probably just some broken path which we can fix relatively easily. Could you please check if the file exists?

The file does not exist. image image

TianyaImpression avatar Nov 16 '22 08:11 TianyaImpression

Apologies for the delay. I have updated the package to try and find the correct proj and gdal paths when the package is loaded. Could you try reinstalling with: devtools::install_github("JohMast/ImageFusion") and then check if you can run the examples?

If it still does not work, it would be interesting to know which versions of R, sf, terra, and possibly rgdal you have installed. Thanks!

JohMast avatar Nov 20 '22 09:11 JohMast

Thank you for your reply! The test code run successful! Uploading image.png…

I use the GIMMS NDVI data from 1982 to 2015 and the MODIS NDVI data from 2001 to 2021 for fusion. The error will be reported, as shown in the figure. Could you tell me why? Thank you!

imagefusion_task( filenames_high = dir_high, dates_high = 229:480, #2001-2021 monthly MODIS NDVI filenames_low = dir_lowrs, dates_low = 1:408, #1982-2015 year monthly gimms NDVI dates_pred = 1:408, out_dir = "./gimmsMonthMaxPredicted/", method = 'estarfm' )

image

TianyaImpression avatar Nov 21 '22 15:11 TianyaImpression

Great! Thanks for your help in troubleshooting this. About the NDVI time series: Could you run the same code with verbose = TRUE in imagefusion_task and post the output? That should give us some clues.

JohMast avatar Nov 21 '22 15:11 JohMast

Ah, i think the issue is that you are inputting two time series which are without gaps, but overlapping. So we have two cases which do not produce a valid job, causing the function to fail:

  1. Low is available, but High is not (dates 1 to 228). In this case, fusion cannot be performed with ESTARFM, which requires two pairs.
  2. Both Low and High are available (dates 228 to 408). No fusion necessary, as highly resolved images already exist.

I will add a check to catch such cases in the future, and return more meaningful error messages.

In your situation, if you seek to extend the high-resolution timeseries backwards, you may want to consider STARM or FITFC which would be able to predict from only a single pair, by using method="starfm and singlepair_mode = "mixed.

JohMast avatar Nov 21 '22 16:11 JohMast

Ah, i think the issue is that you are inputting two time series which are without gaps, but overlapping. So we have two cases which do not produce a valid job, causing the function to fail:

  1. Low is available, but High is not (dates 1 to 228). In this case, fusion cannot be performed with ESTARFM, which requires two pairs.
  2. Both Low and High are available (dates 228 to 408). No fusion necessary, as highly resolved images already exist.

I will add a check to catch such cases in the future, and return more meaningful error messages.

In your situation, if you seek to extend the high-resolution timeseries backwards, you may want to consider STARM or FITFC which would be able to predict from only a single pair, by using method="starfm and singlepair_mode = "mixed.

Thank you for your reply! I runned my data but my PC memory is not enough. Thank you for your help!

TianyaImpression avatar Nov 22 '22 12:11 TianyaImpression