r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
677 stars 146 forks source link

Way to import Earth Engine modules using 'require' ? #213

Closed HunterGleason closed 1 year ago

HunterGleason commented 2 years ago

At submit an issue, please attached the following information of your rgee session:

TRUE

library(rgee)

TRUE

# Initialize the Earth Engine module.
ee_Initialize()

TRUE

# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())

TRUE

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

I am trying to run a Earth Engine Script that requires other Earth Engine modules, specifically, gee-ccdc-tools (https://github.com/parevalo/gee-ccdc-tools)

When running the command: utils <- require('users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api')

I get the Error: Loading required package: users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api’

I expected the 'require' function to import the appropriate earth engine module, but it seems to be using R's 'base::require()' function.

What is the appropriate way to import google earth engine modules using 'rgee'?

What I Did

Researched how to import existing earth engines modules within a 'rgee' script, with no success.

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

utils <- require('users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api') Loading required package: users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api’

gltyree commented 2 years ago

I think this feature is included in rgeeExtra (see rgee issue #155), but when I tried it I got the same error. Here's what I did:

library(rgee)
library(rgeeExtra)

ee_Initialize()

geeBFAST <- require('users/GT/Folder1:Modules/BFASTmonitor_gee.js')

Loading required package: users/GT/MODIS_006_MCD19A2:Modules/BFASTmonitor_GEE.js
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘users/GT/Folder1:Modules/BFASTmonitor_GEE.js’

Is there a particular function included in rgeeExtra that should be used to call .js modules?

HunterGleason commented 2 years ago

I believe you are correct, this functionality is built into the rgeeExtra package. Thanks, I’ll see if I can import the module using the rgeeExtra package.

From: gltyree @.> Sent: February 1, 2022 8:10 AM To: r-spatial/rgee @.> Cc: Gleason, Hunter ENV:EX @.>; Author @.> Subject: Re: [r-spatial/rgee] Way to import Earth Engine modules using 'require' ? (Issue #213)

[EXTERNAL] This email came from an external source. Only open attachments or links that you are expecting from a known sender.

I think this feature is included in rgeeExtra (see rgee issue #155https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fr-spatial%2Frgee%2Fissues%2F155&data=04%7C01%7CHunter.Gleason%40gov.bc.ca%7Cf5e500ef4b134c124fd708d9e59d457f%7C6fdb52003d0d4a8ab036d3685e359adc%7C0%7C0%7C637793285901012050%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9WcspHveJagTh8461OmSw1VtnyjuqqWzjXyj1XK6POg%3D&reserved=0), but when I tried it I got the same error. Here's what I did:

` library(rgee) library(rgeeExtra)

ee_Initialize()

geeBFAST <- require('users/GT/Folder1:Modules/BFASTmonitor_gee.js')

Loading required package: users/GT/MODIS_006_MCD19A2:Modules/BFASTmonitor_GEE.js Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘users/GT/Folder1:Modules/BFASTmonitor_GEE.js’

`

Is there a particular function included in rgeeExtra that should be used to call .js modules?

— Reply to this email directly, view it on GitHubhttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fr-spatial%2Frgee%2Fissues%2F213%23issuecomment-1027012543&data=04%7C01%7CHunter.Gleason%40gov.bc.ca%7Cf5e500ef4b134c124fd708d9e59d457f%7C6fdb52003d0d4a8ab036d3685e359adc%7C0%7C0%7C637793285901012050%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=FvjfcWOZGtBWfETD%2BQ9H1kAXm7sLnyYp02LlC5XIqWo%3D&reserved=0, or unsubscribehttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKCKPCY55F5SDWDGM3JAUA3UZAAUZANCNFSM5LNDM4LA&data=04%7C01%7CHunter.Gleason%40gov.bc.ca%7Cf5e500ef4b134c124fd708d9e59d457f%7C6fdb52003d0d4a8ab036d3685e359adc%7C0%7C0%7C637793285901012050%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VF2DDGq8HEcxntQkiYAk3pwzGJLMzCNKMrrVAE9wOLY%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CHunter.Gleason%40gov.bc.ca%7Cf5e500ef4b134c124fd708d9e59d457f%7C6fdb52003d0d4a8ab036d3685e359adc%7C0%7C0%7C637793285901012050%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=xJbtcwObmADQKuVqC%2BgViyqdPlZl6ltxOXSoMQOLPBg%3D&reserved=0 or Androidhttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CHunter.Gleason%40gov.bc.ca%7Cf5e500ef4b134c124fd708d9e59d457f%7C6fdb52003d0d4a8ab036d3685e359adc%7C0%7C0%7C637793285901012050%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=SDcUK60M6KiG%2BlyvQ2eZdILULyzilTsAA7u17VmWsE0%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>