You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, researchers will upload zip files that a contain nested file and folder structure that we would like to maintain. This reference section will walk you through how to re-upload the contents of the zip file to the Arctic Data Center such that the files and folders are preserved. Note that changing the locations of the files within the package can be tricky, so take these steps with care and try to make sure it is done correctly.
4
4
5
-
With that, here are the steps assuming that the PI has uploaded one zip file to their dataset. You may need to modify the steps for other scenarios, but if you are not sure, feel free to ask the data coordinator. In particular, tar files (.tgz) or rar files (.rar) are also compressed archives that might be better to unpack using command line tools.
5
+
With that, here are the steps assuming that the PI has uploaded one zip file to their dataset that holds all their files organized in their desired file hierarchy. You may need to modify the steps for other scenarios, but if you are not sure, feel free to ask the data coordinator. In particular, tar files (.tgz) or rar files (.rar) are also compressed archives that might be better to unpack using command line tools.
6
6
7
7
### Download the zip file to datateam
8
8
9
9
First, we will download the file, using R.
10
10
11
11
1. Navigate to the dataset landing page on the Arctic Data Center
12
-
2. Right click the "download" button next to the zip file
13
-
3. Select "copy link address"
12
+
2. Right click the "Download" button next to the zip file
13
+
3. Select "Copy Link Address"
14
14
4. Run the following two lines of code to set the URL variable, and extract the pid
15
15
16
16
Here is an example on the test site. Note that on production, you will need to change the URL that you are substituting in the second line of code.
Note that this will download the file to the location you specify as the second argument in `writeBin`. If you are organizing your scripts and data by submitter, it would look like the example below.
Now if you look at the directory, you shuold see the unzipped contents of the file in a subdirectory of `~/Submitter`. The name of the directory will be the name of the folder the PI created the archive from.
41
+
Now if you look at the directory, you should see the unzipped contents of the file in a sub-directory of `~/submitter/data`. The name of the directory will be the name of the folder the PI created the archive from. In this case, that folder is titled `final_image_set`.
42
42
43
-
Right now, you should stop and examine each file in the directory closely (or each type of file). You may need to make some minor adjustments or ask for clarification from the PI. For example, we still may need to ask for csv versions of excel files, you may need to re-zip certain directories (for example: a zip which contains 5 different sets of shapefiles should be turned into 5 different zips). Evaluate the contents of the directory alongside the data coordinator.
43
+
Right now, you should stop and examine each file in the directory closely (or each type of file). You may need to make some minor adjustments or ask for clarification from the PI. For example, we still may need to ask for CSV versions of Excel files, you may need to re-zip certain directories (for example: a zip which contains 5 different sets of shapefiles should be turned into 5 different zips). Evaluate the contents of the directory alongside the data coordinator.
44
44
45
45
### Re-upload the contents to the Arctic Data Center
46
46
@@ -49,59 +49,60 @@ Once you have confirmed everything is all good, we can upload the files to the A
49
49
First, get the data package loaded into your R session as usual. I recommend not attempting any EML edits while you do these steps, this update adding the files is best done on it's own, and EML edits can be done on the next version.
Next, we will set up two types of paths describing each of the objects. The first will be an absolute path, so we can be sure the R function finds the files. The second will be a relative path, which will be what shows up on the landing page (or in the download all result) of the data package.
55
+
Next, we will set up two types of paths describing each of the objects. The first will be an absolute path, so we can be sure the R function finds the files. The second will be a relative path, which will be what shows up on the landing page (or in the "Download All" result) of the data package.
56
56
57
57
```{block, type = "warning"}
58
58
If you don't know the difference between an absolute and relative path, read on. It is SUPER IMPORTANT!
59
59
60
60
A path is a location of a file or folder on a computer. There are two types of paths in computing: absolute paths and relative paths.
61
61
62
-
An absolute path always starts with the root of your file system and locates files from there. The absolute path to my example submitter zip is: `/home/jclark/Submitter/example.zip`. The generic shortcut `~/` is often used to replace the location of your home directory (`/home/username`) to save typing, but your path is still an absolute path if it starts with `~/`. Note that a relative path will **always** start with either `~/` or `/`.
62
+
*Absolute paths* always start with the root of your file system and locates files from there. The absolute path to my example submitter zip is: `/home/jclark/submitter/data/example.zip`. The generic shortcut `~/` is often used to replace the location of your home directory (`/home/username`) to save typing, but your path is still an absolute path if it starts with `~/`. Note that a relative path will **always** start with either `~/` or `/`.
63
63
64
-
Relative paths start from some location in your file system that is below the root. Relative paths are combined with the path of that location to locate files on your system. R (and some other languages like MATLAB) refer to the location where the relative path starts as our working directory. If our working directory is set to `~/Submitter`, the relative path to the zip would be just `example.zip`. Note that a relative path will **never** start with either `~/` or `/`.
64
+
*Relative paths* start from some location in your file system that is below the root. Relative paths are combined with the path of that location to locate files on your system. R (and some other languages like MATLAB) refer to the location where the relative path starts as our working directory. If our working directory is set to `~/submitter`, the relative path to the zip would be just `data/example.zip`. Note that a relative path will **never** start with either `~/` or `/`.
65
65
```
66
66
67
-
Getting these paths right is very important because we don't want submitters to download a folder of data, and have the paths look like `/home/internname/ticket_27341/important_folder/important_file.csv`. The first part of that path is particular to however the person processing the ticket organized the data, and is not how the submitter of the data intented to organize the data. Follow the steps below to make sure this does not happen.
67
+
Getting these paths right is very important because we don't want submitters to download a folder of data, and have the paths look like `/home/internname/ticket_27341/important_folder/important_file.csv`. The first part of that absolute path is particular to however the person processing the ticket organized the data, and is not how the submitter of the data intended to organize the data. Follow the steps below to make sure this does not happen.
68
68
69
-
1.get a list of absolute paths for each file in the directory. **NOTE** The "PI_dir_name" here represents whatever directory you retrieved after running `unzip` in the previous step. The actual .zip file should not be in this directory.
69
+
1.Get a list of absolute paths for each file in the directory. **NOTE** The "PI_dir_name" here represents whatever directory you retrieved after running `unzip` in the previous step. The actual .zip file should not be in this directory. In our example, this "PI_dir_name" is `final_image_set`.
70
70
71
-
2.get a list of relative paths for each file in the directory. Note this is the same command, but with the argument `full.names` set to `FALSE`.
71
+
2.Get a list of relative paths for each file in the directory. Note this is the same command, but with the argument `full.names` set to `FALSE`.
Make sure that these paths look correct! They should contain ONLY the files that were unzipped. If you have other scripts or metadata files you might want to rearrange your directories to get the correct paths. The relative paths should start with the submitter's directory name. In this examplethey will look like the below:
79
+
Make sure that these paths look correct! They should contain ONLY the files that were unzipped. If you have other scripts or metadata files you might want to rearrange your directories to get the correct paths. The *relative paths* should start with the submitter's directory name. In this example, that submitter's top-level directory is titled `final_image_set`, so they will look like the names below:
Now for each of these files, we can create a `dataObject` for them and add them to the package using a loop. Before running this, look at the values of your `abs_paths` and `rel_paths` and make sure they look correct based on what you know about both paths and the structure of the directory. Within this loop we will also create otherEntities for each item, just putting in the bare minimum of information that will help us make sure that we know what files are what.
Once this is finished you can examine the relationships by running `View(dp@relations$relations)`. If everything worked out well you should see rows that look like this:
@@ -127,24 +128,111 @@ Finally, check your work. Go to the Arctic Data Center and see if the package di
127
128
Here is the example code all put together. Make sure you change all of the relevant bits, and check your work carefully!!
One note: if you have files you want to keep in your dataset along with the ZIP file contents you're adding, you can run `doc$dataset$otherEntity <- c(doc$dataset$otherEntity, oes)` so that you'll just be adding your new entities instead of replacing the older ones.
174
+
175
+
### Example with multiple ZIP files
176
+
177
+
Here is an example script for a dataset in which the PI uploaded multiple ZIP files they wanted to represent different folders of their dataset
0 commit comments