comparison val_metadata.r @ 0:a8dabbf47e15 draft

planemo upload for repository https://github.com/Marie59/Sentinel_2A/srs_tools commit b32737c1642aa02cc672534e42c5cb4abe0cd3e7
author ecology
date Mon, 09 Jan 2023 13:39:08 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a8dabbf47e15
1 #Rscript
2
3 ############################################
4 ## Validate ISO 19139 metadata documen ##
5 ############################################
6
7 #####Packages : ncdf4,
8 # geometa,
9 # httr
10 # xml
11 # xml2
12 library(geometa)
13
14 #####Load arguments
15
16 args <- commandArgs(trailingOnly = TRUE)
17
18 if (length(args) < 1) {
19 stop("This tool needs at least 1 argument")
20 }else {
21 input_data <- args[1]
22 }
23
24 ##------------------------------------------##
25 ## Read ISO 19139 from a file or url ##
26 ##------------------------------------------##
27
28 # Test depuis catalogue Indores http://indores-tmp.in2p3.fr/geonetwork/srv/fre/catalog.search#/metadata/112ebeea-e79c-422c-8a43-a5a8323b446b
29 # <!--ISO 19139 XML compliance: NO-->
30 input_data <- xml2::read_xml(input_data)
31
32 dir.create("results")
33 file.create("results/meta.xml")
34
35 xml2::write_xml(input_data, file = "results/meta.xml")
36
37 md <- geometa::readISO19139("results/meta.xml")
38
39
40 # validate iso
41 cat("\nValidation of metadata according to ISO 19139\n", md$validate(), file = "Metadata_validation.txt", fill = 1, append = FALSE)