gee-takeout:命令行界面允许您将所有代码和资产从一个Google帐户复制到另一个帐户

  • r3_990519
    了解作者
  • 5.2MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-29 06:16
    上传日期
Google外卖和转移:代码和资产转移的工具和指南 命令行界面允许您将所有代码和资产从一个Google帐户复制到另一个帐户 注意:这是我已经测试过的东西,并且仅针对带有python 2.7.14的Windows机器设计,但是可以很容易地移植到其他操作系统中。 使用这些工具和步骤需要您自担风险,并总是以防万一地备份脚本。 如果您仍然想继续阅读(假设您仍在阅读),我会提供指向我制作的工具的说明链接以及为实现该目的而使用的步骤。 该工具是具有三个部分的单个命令行界面。 在执行此操作之前,请确保以下几点 您的两个Google帐户都有一个外部密码,因为它要求下载并执行许多操作。 同时启用在这两个上都。_ 您的系统在终端或命令提示符中具有本机python,具体取决于您所使用的系统类型。 您可以通过键入python --version进行检查 _Git已安装在您的系统上。 对于Windows,您
gee-takeout-master.zip
  • gee-takeout-master
  • setup.py
    1.3KB
  • requirements.txt
    196B
  • LICENSE
    11.1KB
  • README.md
    12.4KB
  • geetakeout
  • geetakeout.py
    9.3KB
  • git_copy.py
    2KB
  • gee_report.py
    1.7KB
  • gee_permissions.py
    2.1KB
  • __init__.py
    112B
  • geckodriver
    6.9MB
  • gee_assetcopy.py
    3KB
  • gee_replicate.py
    1.5KB
  • git_geerepolist.py
    1.3KB
  • git_repocreate.py
    2.3KB
  • sel-latest-linux.py
    1.7KB
  • git_swap.py
    337B
  • git_password.py
    2KB
  • sel-latest-win.py
    1.6KB
  • git_replicate.py
    2.4KB
  • geckodriver.exe
    9.2MB
内容介绍
# Google Takeout and Transfer: Tools and Guide for Code and Asset Transfer [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1185158.svg)](https://doi.org/10.5281/zenodo.1185158) [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/samapriya) Command Line Interface Allows you to copy all codes and assets from one Google account to another **Note: This is something that I have tested and have designed only for a windows machine with python 2.7.14 but can be easily ported into an different operating system. Use these tool and steps at your own risk and backup your scripts always just in case.** If you still want to proceed which I assume you do in case you are still reading, I am including descriptions links to the tool I made and the steps I used to achieve the same. The tool is a single command line interface with three sections. **Before you do this make sure of a few things** * _Both your google accounts have an external password, since it requires that to download and perform a lot of the operations. Also enable [__Let Less Secure App use your account_][1]_ on both these accounts._ * _Your system has native python available in terminal or command prompt depending on what kind of system you are using. You can check this by typing_ `python --version` * _Git is installed on your system. For windows you can find [__installation here_][2] * _Earth Engine Command Line(earthengine cli) interface is installed, instructions are in the [__developer page_][3] * _You have authenticated earthengine cli using _`earthengine authenticate` * _Make sure you visit the [__git source for your account_][4]_ within earth engine and allow access._ * _Check git is accessible via your system path type_ `git help` _and check if the system can reach installed git command line tools._ Now we setup and install the tool by running the following set of steps. The Github repository containing this tool and codes [can be found here][5] For windows [download the zip here][6] and after extraction go to the folder containing "setup.py" and open command prompt at that location and type python setup.py install pip install -r requirements.txt Now call the tool for the first time, by typing in `geetakeout -h`. This will only work if you have python in the system path which you can test for opening up terminal or command prompt and typing `**python**.` If you want, you don't have to install the tool to use it you can browse to the folder geetakeout inside the main zipped folder. You can then call the tool by simple `python geetakeout.py -h` The housekeeping and credential setup is optional since most of you have probably installed the earthengine cli and authenticated it using `**earthengine authenticate**.` > **Anatomy of the Process: How to transfer step by step** Getting first things out of the way is to understand the three sections of this tool. To make life and this process simpler I designed the tool to have a flow so you can run these tools one after the other. The _EE Setup and Housekeeping_ sections are optional , since I will generally updated the selenium driver for mozilla and it assumes you have authenticated your earthengine CLI . The tool might show an error if you have not authenticated using earthengine authenticate If you have installed the tool run geetakeout -h If you have migrated into the folder python geetakeout.py -h ![][7] The GEE Takeout Tool CLI printout **Setting up the case study** For this blog I decided to make the transfer simple I have a university account but since my university if shifting umail services to a google app service it means my domain would change from @umail.iu.edu to @iu.edu which are separate accounts. I created the iu.edu GEE account recently. ![][8] Code Editor comparison Left(my @umail account and right my @iu account) This also means that the root path for my home folder and repository are different. The idea is simple to be able to replicate the codes and assets from one account to the other. This includes every type if assets including collections but also making sure that the structure of the folders are same. That being said you will still have to change the home path in the codes but if the structure is same then only a single root-path changes. ![][9] Comparing the root path and assets folder for both accounts So now that we have a setup, I am going to approach it step by step and have a walk through to explain the process better. **Step 1: Getting your Repository Lists(gee_repo)** This assumes that you have visited the Git Source for your codes in Google Earth Engine and authorized it. If not [allow it here][4] and then you are set to download your repo contents and perform git operations. The tool is setup for accessing all repositories that are shared with you. This downloads the list into an html file which can then be parsed for your repositories. ![][10] Create GEE Repo List **Step 2: Setting up your Git with Earth Engine Credentials(git_auth)** You can do this using two methods * The first simple includes you visiting your [gitsource account page ][4]that we accessed earlier and click `**Generate Password **`and follow instructions. I am going to talk more about the second method because this eliminates the need to get the password again and again since it is save as passkey. This will authenticate your git client with your git password using a browser less login and also store your gitkey ![][11] GIT Auth (saves git key) We will use this again to setup our second account post authorization. This will print our gitkey location and make sure you copy that so you can swap in out as needed. Note the name of the key is in the format `**git-"username"**`** **in this case it is `**git-roysam**` **Step 3: Authorize your Git Client with Git Key(git_swap)** The next step is to use the saved gitkey to authorize the git client. We are setting everything up so that we can clone the repositories to which we have access. ![][12] Authorize using the git key stored earlier **Step 4: Clone your repositories(git_clone)** This tool makes use of your earlier created GIT list, now that your git client has been authorized in step 2, you should be able to download your repos. This tool uses the account already linked to your terminal account. If you are not sure try `**earthengine ls**` to see your username. The export path is noted for the collection of repositories. ![][13] Cloning your Git Repositories **Step 5: Working with Assets: Generating Asset Report(ee_report)** This includes all your assets , including tables, images, image collections and folders. We need to make sure we have this list to work on copying over your assets to the secondary account. Running this is simple and just requires a location for the csv file (the full path). ![][14] Running Earth Engine Reports The output is a csv file consiting of the type of asset and the asset path to be replicated in the new account. And now that we have the list time to get permissions to copy these assets. **Step 6: Setting Permissions to Assets(ee_permissions)** We now use the report file generated to grant read access to all assets in your account. Once this is completed you will be able to copy your assets apart from being able to copy your codes. ![][15] Getting permissions to assets **Let us Begin to Copy : We change gears and switch over to the destination account** **Step 7: Setting up the Destination Account(ee_user and git_swap)** Now we have to do two steps one after the other, do a quick earthengine authenticate and authenticate to your new account and perform Step 2 and Step 3 this time using your new account. The tool `**ee_user**` will also allow you to change your accounts. I already created Step 2 for my secondary account and now I will use that to authorize my
评论
    相关推荐