Skip to content

Commit

Permalink
fix(data-layers): fix land cover and minor improvements (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach authored Aug 10, 2020
1 parent 0383325 commit fb9e6a2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions data/add-time-coordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
parser.add_argument("-t", "--timestamp", dest="timestamp")
args = parser.parse_args()

ds = xr.open_dataset(args.file, decode_cf=False)
ds = xr.open_dataset(args.file, decode_cf=False, decode_coords=False)

new_time = pd.to_datetime([args.timestamp])
ds = ds.expand_dims(dim={'time': new_time}, axis=0)

os.remove(args.file)
ds.to_netcdf(args.file, format='NETCDF4', mode='w')
ds.to_netcdf(args.file, format='NETCDF4_CLASSIC', mode='w')
2 changes: 1 addition & 1 deletion data/drop-unused-vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
ds = ds.drop_vars(names=[key])

os.remove(args.file)
ds.to_netcdf(args.file, format='NETCDF4', mode='w')
ds.to_netcdf(args.file, format='NETCDF4_CLASSIC', mode='w')
2 changes: 1 addition & 1 deletion data/gdal-colors/colors-AOD550_mean.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
5 192 75 20 255
2.5 241 162 33 220
2.5 241 162 33 255
0.5 250 220 40 44
0 250 220 40 0
nv 0 0 0 0
5 changes: 3 additions & 2 deletions data/layers-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,12 @@
"year": "numeric",
"month": "long"
},
"units": "m",
"flyTo": {
"position": {
"height": 5500000,
"latitude": -38.5,
"longitude": 72.29
"latitude": 72.29,
"longitude": -38.5
},
"orientation": {
"heading": 0,
Expand Down
6 changes: 3 additions & 3 deletions data/triggers/land_cover_lccs_class.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env bash

TIMEOUT=12000
TIMEOUT=24000
LAYER_ID="land_cover.lccs_class"
VARIABLE_ID="lccs_class"
VERSION="0.6.1"
ZOOM_LEVELS="0-5"
ZOOM_LEVELS="0-7"
MIN_LON="-180"
MAX_LON="180"
MIN_LAT="-90"
MAX_LAT="90"
MIN=0
MAX=220
MACHINE_TYPE="N1_HIGHCPU_8"
MACHINE_TYPE="N1_HIGHCPU_32"

if [ ! -f ./package.json ]; then
echo "You have to be in the root folder of the project to run this script!"
Expand Down
7 changes: 3 additions & 4 deletions data/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ def write_metadata_file(layer_id, variable_id, units, timesteps, max_zoom, min,

metadata = {
'id': layer_id,
'colorMap': layer_data['colorMap'],
'timeFormat': layer_data['timeFormat'],
'minValue': min,
'maxValue': max,
'units': layer_data.get('units') or units,
'zoomLevels': max_zoom,
'timestamps': timestamps
'timestamps': timestamps,
'units': units,
**layer_config[layer_id]
}

with open('./metadata.json', 'w') as f:
Expand Down
2 changes: 1 addition & 1 deletion data/write-zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# open dataset
ds = cate.ops.open_dataset(ds_local_name, var_names=args.variable_id)
data_array = ds[args.variable_id]
units = data_array.get('units') or data_array.attrs['Units']
units = data_array.attrs.get('units') or data_array.attrs.get('Units')

# get min and max values
try:
Expand Down

0 comments on commit fb9e6a2

Please sign in to comment.