Skip to content
8 changes: 8 additions & 0 deletions au.org.access-nri/model/output/file-metadata/2-1-0/2-1-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
},
"variables": {
"type": "object",
"properties": {
"time": {
"$ref": "variable/time.json"
},
"time_bnds": {
"$ref": "variable/time_bnds.json"
}
},
"patternProperties": {
"^.+$": {
"$ref": "variable.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "variable/time.json",
"title": "time",
"description": "The time variable for the dataset.",
"type": "object",
"required": [
"axis",
"calendar",
"long_name",
"standard_name",
"units"
],
"properties": {
"axis": {
"const": "T"
},
"bounds": {
"const": "time_bnds"
},
"calendar": {
"$ref": "time/calendar.json"
},
"long_name": {
"const": "time"
},
"standard_name": {
"const": "time"
},
"units": {
"$ref": "time/units.json"
}
},
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "variable/time/calendar.json",
"title": "calendar",
"description": "Calendar defines the set of valid datetimes and their order. Follows the CF-Convention names using lower-case strings. It is recommended that \"proleptic_gregorian\" is used for data with leap days and \"no_leap\"/\"365_day\" for data without leap days.",
"type": "string",
"enum": [
"standard",
"julian",
"proleptic_gregorian",
"no_leap",
"365_day",
"all_leap",
"366_day",
"360_day",
"utc",
"tai"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "variable/time/units.json",
"title": "units",
"description": "Units for time should be given as \"days since X\" where X is a date (yyyy-mm-dd) or a datetime (yyyy-mm-dd HH:MM or yyyy-mm-dd HH:MM:SS)",
"examples": [
"days since 0001-01-01 00:00:00",
"days since 0001-01-01 00:00",
"days since 1970-01-01",
"days since -5000-12-25"
],
"type": "string",
"pattern": "^days since -?\\d{4}-(1[012]|0[1-9])-(3[01]|[12][0-9]|0[1-9])( ([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?)?$"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "variable/time_bnds.json",
"title": "time_bnds",
"description": "The time_bnds variable for the dataset. Note this variable has no attributes.",
"const": {}
}
10 changes: 10 additions & 0 deletions tests/2-1-0/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
"standard_name": "latitude",
"units": "degrees_north",
"long_name": "latitude"
},
"time": {
"axis": "T",
"bounds": "time_bnds",
"calendar": "proleptic_gregorian",
"long_name": "time",
"standard_name": "time",
"units": "days since 0001-01-01 00:00"
},
"time_bnds": {
}
}
}
Expand Down
51 changes: 51 additions & 0 deletions tests/2-1-0/variable/test_time.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"target": "../../../au.org.access-nri/model/output/file-metadata/2-1-0/variable/time.json",
"tests": [
{
"description": "Full valid time variable",
"valid": true,
"data": {
"axis": "T",
"bounds": "time_bnds",
"calendar": "proleptic_gregorian",
"long_name": "time",
"standard_name": "time",
"units": "days since 0000-01-01"
}
},
{
"description": "Full valid time variable without bounds",
"valid": true,
"data": {
"axis": "T",
"calendar": "proleptic_gregorian",
"long_name": "time",
"standard_name": "time",
"units": "days since 0000-01-01"
}
},
{
"description": "Missing required (long_name)",
"valid": false,
"data": {
"axis": "T",
"bounds": "time_bnds",
"calendar": "proleptic_gregorian",
"standard_name": "time",
"units": "days since 0000-01-01"
}
},
{
"description": "Const doesn't match",
"valid": false,
"data": {
"axis": "T",
"bounds": "time_bounds",
"calendar": "proleptic_gregorian",
"long_name": "time",
"standard_name": "time",
"units": "days since 0000-01-01"
}
}
]
}
25 changes: 25 additions & 0 deletions tests/2-1-0/variable/time/test_calendar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"target": "../../../../au.org.access-nri/model/output/file-metadata/2-1-0/variable/time/calendar.json",
"tests": [
{
"description": "Valid calendar",
"valid": true,
"data": "proleptic_gregorian"
},
{
"description": "Valid calendar but capitalised",
"valid": false,
"data": "PROLEPTIC_GREGORIAN"
},
{
"description": "Invalid calendar",
"valid": false,
"data": "invalid_calendar"
},
{
"description": "Not even a string",
"valid": false,
"data": 6
}
]
}
40 changes: 40 additions & 0 deletions tests/2-1-0/variable/time/test_units.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"target": "../../../../au.org.access-nri/model/output/file-metadata/2-1-0/variable/time/units.json",
"tests": [
{
"description": "Valid units for time",
"valid": true,
"data": "days since 0001-01-01 00:00:00"
},
{
"description": "Valid units for time - no seconds",
"valid": true,
"data": "days since 0001-01-01 00:00"
},
{
"description": "Valid units for time - no time",
"valid": true,
"data": "days since 0001-01-01"
},
{
"description": "Invalid units for time - not real time",
"valid": false,
"data": "days since 0001-01-01 00:00:61"
},
{
"description": "Invalid units for time - not days",
"valid": false,
"data": "seconds since 0001-01-01 00:00:00"
},
{
"description": "Invalid units for time",
"valid": false,
"data": "not even close to valid"
},
{
"description": "Invalid units for time - not a string",
"valid": false,
"data": 5
}
]
}
Loading