Skip to content

Commit

Permalink
Merge branch 'r-spatial:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ambarja authored Jul 4, 2024
2 parents 86816ae + b980141 commit d56dd92
Show file tree
Hide file tree
Showing 48 changed files with 538 additions and 518 deletions.
68 changes: 37 additions & 31 deletions .github/db_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,43 @@
import json
import re


def dataset_upgrade():
earth_engine_list = "https://raw.githubusercontent.com/samapriya/Earth-Engine-Datasets-List/master/gee_catalog.json"

with request.urlopen(earth_engine_list) as url:
ee_datasets = json.loads(url.read().decode())

FeatureCollection = OrderedDict()
ImageCollection = OrderedDict()
Image = OrderedDict()

for ee_dataset in ee_datasets:
key_name = re.sub("/", "_", ee_dataset["id"])
if (ee_dataset["type"] == "table") or (ee_dataset["type"] == "table_collection"):
FeatureCollection[key_name] = ee_dataset["id"]
elif ee_dataset["type"] == "image":
Image[key_name] = ee_dataset["id"]
elif ee_dataset["type"] == "image_collection":
ImageCollection[key_name] = ee_dataset["id"]
else:
raise Exception("We expected a type value: image, image_collection or table.")

eeDataset = OrderedDict(
FeatureCollection = FeatureCollection,
ImageCollection = ImageCollection,
Image = Image
)

with open('inst/dataset.json', 'w') as json_file:
json.dump(eeDataset, json_file)

return True
earth_engine_list = "https://raw.githubusercontent.com/samapriya/Earth-Engine-Datasets-List/master/gee_catalog.json"

with request.urlopen(earth_engine_list) as url:
ee_datasets = json.loads(url.read().decode())

FeatureCollection = OrderedDict()
ImageCollection = OrderedDict()
Image = OrderedDict()

for ee_dataset in ee_datasets:
key_name = re.sub("/", "_", ee_dataset["id"])
if (ee_dataset["type"] == "table") or (
ee_dataset["type"] == "table_collection"
):
FeatureCollection[key_name] = ee_dataset["id"]
elif ee_dataset["type"] == "image":
Image[key_name] = ee_dataset["id"]
elif ee_dataset["type"] == "image_collection":
ImageCollection[key_name] = ee_dataset["id"]
else:
raise Exception(
"We expected a type value: image, image_collection or table."
)

eeDataset = OrderedDict(
FeatureCollection=FeatureCollection,
ImageCollection=ImageCollection,
Image=Image,
)

with open("inst/dataset.json", "w") as json_file:
json.dump(eeDataset, json_file)

return True


if __name__ == "__main__":
dataset_upgrade()
dataset_upgrade()
8 changes: 4 additions & 4 deletions .github/ee_up.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import ee

words = [
"#' Earth Engine API version",
"#' Earth Engine API version",
"#'",
"#'",
"#' @family session management functions",
"#' @return Character. Earth Engine Python API version used to build rgee.",
"#' @export",
"ee_version <- function() {",
" '%s'" % (ee.__version__),
"}"
"}",
]

with open("R/ee_version.R", "w") as file:
file.write("\n".join(words))
file.write("\n".join(words))
Loading

0 comments on commit d56dd92

Please sign in to comment.