Skip to content

Commit

Permalink
Merge pull request #112 from daltonkell/cc_issue_831
Browse files Browse the repository at this point in the history
Remove function that alters the dimensions of .cdl
  • Loading branch information
daltonkell authored Jul 23, 2020
2 parents d9b90b3 + afd0f6b commit a67dbad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 76 deletions.
30 changes: 0 additions & 30 deletions cchecker_web/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,39 +105,9 @@ def check_for_cdl(filename, filepath):
nc_file = filename.replace('.cdl', '.nc')
nc_path = os.path.join(os.path.dirname(filepath),
encode(nc_file))
filepath = update_cdl_dimensions(filepath)
generate_dataset(nc_path, filepath)
filepath = nc_path
return filepath


def update_cdl_dimensions(filepath):
'''
Rewrite the cdl file to make all dimensions size 1
:param str filepath: Absolute path to .cdl file
'''
transform = False
data = []
with open(filepath, 'r') as f:
lines = f.readlines()

for line in lines:
if 'variables:' in line:
transform = False
elif transform:
prefix = line.split('=')[0]
line = prefix + '= 1 ;\n'
elif 'dimensions:' in line:
# This is where we start transforming dimensions
transform = True
data.append(line)

# Re write the file
with open(filepath, 'w') as f:
f.write(''.join(data))
return filepath


def encode(s):
return base64.b64encode(s.encode('utf-8')).decode('ascii')
12 changes: 7 additions & 5 deletions contrib/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
COMMON: &common
MAX_CONTENT_LENGTH: 16793600 # 16 MB
LOGGING: True
LOG_FILE_PATH: '/var/log/ccweb/'
LOG_FILE: 'cchecker_web.log'
LOG_FILE_PATH: /var/log/ccweb/
LOG_FILE: cchecker_web.log
HOST: localhost
PORT: 3000
DEBUG: True
UPLOAD_FOLDER: /var/run/datasets
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_DB: 0
DEBUG: True

CACHE:
CACHE_TYPE: simple


GOOGLE_ANALYTICS_ID:

DEVELOPMENT: &development
<<: *common
<<: *common
DEBUG: True

PRODUCTION: &production
Expand Down
40 changes: 0 additions & 40 deletions contrib/docker/my_init.d/run.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@
#!/bin/bash
set -ex

: ${MAX_CONTENT_LENGTH:=16793600}
: ${LOGGING:=true}
: ${LOG_FILE_PATH:=/var/log/ccweb/}
: ${LOG_FILE:=cchecker_web.log}
: ${UPLOAD_FOLDER:=/var/run/datasets}
: ${REDIS_HOST:=redis}
: ${REDIS_PORT:=6379}
: ${REDIS_DB:=0}
: ${DEBUG:=false}

cat << EOF > /usr/lib/ccweb/config.yml
COMMON: &common
MAX_CONTENT_LENGTH: ${MAX_CONTENT_LENGTH}
LOGGING: ${LOGGING}
LOG_FILE_PATH: ${LOG_FILE_PATH}
LOG_FILE: ${LOG_FILE}
HOST: localhost
PORT: 3000
DEBUG: True
UPLOAD_FOLDER: /var/run/datasets
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_DB: 0
DEBUG: True
CACHE:
CACHE_TYPE: simple
GOOGLE_ANALYTICS_ID: ${GOOGLE_ANALYTICS_ID}
DEVELOPMENT: &development
<<: *common
DEBUG: True
PRODUCTION: &production
<<: *common
DEBUG: ${DEBUG}
EOF

set -e
wait_for_redis(){
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
command: redis-server --appendonly yes

compliance-checker:
image: test_ccweb:latest
image: ioos/compliance-checker-web:latest
container_name: compliance-checker-web
env_file: .env
volumes:
Expand Down

0 comments on commit a67dbad

Please sign in to comment.