JRCSTU / CO2MPAS-TA

EU's Type-Approving vehicle simulator predicting NEDC CO2 emissions from WLTP
https://co2mpas.readthedocs.io/
European Union Public License 1.1
23 stars 13 forks source link

How to review the content of the final zip file #32

Closed MaikeruJon closed 5 years ago

MaikeruJon commented 5 years ago

Is it possible to review the content of the final zip file created at the end of the DICE run? I understand that we keep that file with a copy of the approval for future reference, if required. It seems to contain just binary files, with nothing intelligible just by opening with a normal zip client. Is there information within that final file that might be of use and interest to someone wishing to review it, and if so, how should they turn it into something intelligible?

ankostis commented 5 years ago

The final zip exported contains all project(s) files as a barebone git repository.

To see those files, you need to adapt the low-level git-commands given below. In general, some experience with git command would be helpful.

NOTE: The commands below are for bash: in AIO-console press Ctrl+F2 and a "brown" tab will open.

Retrieve files from an exported co2mpas zip-archive:

1. Locate the zip archive and exctract the "barebone" git-repository contained

if you have not already done so:

$ ls -l CO2MPAS_projects-20180814-185500.zip
-rw-r--r-- 1 user group 4456773 Aug 16 16:14 CO2MPAS_projects-20180814-185500.zip
```console

$ unzip CO2MPAS_projects-20180814-185500.zip
Archive:  CO2MPAS_projects-20180814-185500.zip
   creating: repo/
   creating: repo/branches/
...
   creating: repo/refs/tags/dices/IP-12-ABC-1/
  inflating: repo/refs/tags/dices/IP-12-ABC-1/0

2. Create your new "proper" repository:

$ mkdir myprojects
$ cd myprojects
$ git init
Initialized empty Git repository in D:/co2mpas_AIO/CO2MPAS/myprojects/.git/

3. Tell your new repo about the extracted barebone-repo, and then fetch its contents

let's call the "remote" link as barerepo:

$ git remote add barerepo ../repo
$ git fetch barerepo
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 11 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From ../repo
 * [new branch]      projects/IP-12-ABC-1 -> barerepo/projects/IP-12-ABC-1
 * [new tag]         dices/IP-12-ABC-1/0  -> dices/IP-12-ABC-1/0
 * [new tag]         dices/IP-12-ABC-1/0  -> dices/IP-12-ABC-1/1

We see that the archive contained just a single project IP-12-ABC-1 and 2 reports (dice & stamp).

4. Check-out the branch for your project:

$ git checkout projects/IP-12-ABC-1
Switched to a new branch 'projects/IP-12-ABC-1'
Branch 'projects/IP-12-ABC-1' set up to track remote branch 'projects/IP-12-ABC-1' from 'barerepo'.

NOTE: more branches might exist, in case you had run the co2dice project export command without specifying a project argument.

5. The co2mpas files are now in inp, out dirs:

$ ls -la
drwxrwxr-x+ 1 user group   0 Aug 16 16:11 ./
drwxrwx---+ 1 user group   0 Aug 16 16:01 ../
drwxrwxr-x+ 1 user group   0 Aug 16 16:11 .git/
-rwxrwxr-x+ 1 user group 122 Aug 16 16:11 CO2MPAS*
drwxrwxr-x+ 1 user group   0 Aug 16 16:11 inp/
drwxrwxr-x+ 1 user group   0 Aug 16 16:11 out/
drwxrwxr-x+ 1 user group   0 Aug 16 16:12 tstamp.txt

$ $ ls -l inp out
inp:
total 2976
-rwxrwxr-x+ 1 user group 3046352 Aug 16 16:11 co2mpas_demo-1.xlsx*

out:
total 2324
-rwxrwxr-x+ 1 user group 2376548 Aug 16 16:11 20180812_213917-co2mpas_demo-1.xlsx*

- Repeat from step-4 to get files from other projects (if any).

- Repeat from step-1 to extract from more archives,

but each time skip step-2 and use a different remote-name in step-3 - so you don't have to create the "proper" myprojects repo again.

- View all reports (tags):

$ git tag | xargs -n1 git cat-file tag
object f30d231d3090b08ac32574d293a0de3971a688c7
type commit
tag dices/IP-10-AAA-2017-1000/0
tagger Kostis Anagnostopoulos <ankostis@gmail.com> 1529962453 +0100

- {v: 1.0.2, a: drep 2 files, p: IP-10-AAA-2017-1000, s: tagged}

- file: co2mpas_demo-1.xlsx
  iokind: inp
  report: {vehicle_family_id: IP-10-AAA-2017-1000, timestamp: 1529344771.2481759}
MaikeruJon commented 5 years ago

Thank you very much