-
Notifications
You must be signed in to change notification settings - Fork 1
Developing a solution for u-cp647
#95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
0d64175
05c2d60
fce11db
544e45f
5d42c94
4e73a34
7a80b9a
b98cb26
eaf1134
f04e69c
faefa20
8f9805a
e603f5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,15 +409,18 @@ def download_from_mass( | |
outputFold = folder([paths.ModelFolder_pref, jobID,] ) | ||
# make this folder group writeable. | ||
st = os.stat(outputFold) | ||
os.chmod(outputFold, st.st_mode | stat.S_IWGRP) | ||
|
||
try: os.chmod(outputFold, st.st_mode | stat.S_IWGRP) | ||
except: pass | ||
|
||
|
||
deleteBadLinksAndZeroSize(outputFold, jobID) | ||
|
||
fixFilePaths(outputFold, jobID) | ||
deleteBadLinksAndZeroSize(outputFold, jobID) | ||
|
||
# Set up a file to save command to a new file. | ||
download_script_path = ''.join([folder('mass_scripts/'), jobID,'.sh']) | ||
username = os.getlogin() | ||
download_script_path = ''.join([folder('mass_scripts/'), jobID,'_',username, '.sh']) | ||
ledm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
header_lines = ['# Run this script on mass-cli1.jasmin.ac.uk\n',] | ||
header_lines.append('# from login1.jasmin.ac.uk, ssh to the mass machine:\n# ssh -X mass-cli\n') | ||
header_lines.append(''.join(['# run script with:\n# source ', os.path.abspath(download_script_path),'\n'])) | ||
|
@@ -483,7 +486,8 @@ def download_from_mass( | |
if auto_download: | ||
shared_file_path = os.path.join(paths.shared_mass_scripts, os.path.basename(download_script_path)) | ||
print('writing file in shared path', shared_file_path) | ||
shutil.copy(download_script_path, shared_file_path) | ||
try: shutil.copy(download_script_path, shared_file_path) | ||
except: pass | ||
|
||
|
||
fixFilePaths(outputFold, jobID, debug=False,) | ||
deleteBadLinksAndZeroSize(outputFold, jobID, debug=False,) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2023, Plymouth Marine Laboratory | ||
# | ||
# This file is part of the bgc-val library. | ||
# | ||
# bgc-val is free software: you can redistribute it and/or modify it | ||
# under the terms of the Revised Berkeley Software Distribution (BSD) 3-clause license. | ||
|
||
# bgc-val is distributed in the hope that it will be useful, but | ||
# without any warranty; without even the implied warranty of merchantability | ||
# or fitness for a particular purpose. See the revised BSD license for more details. | ||
# You should have received a copy of the revised BSD license along with bgc-val. | ||
# If not, see <http://opensource.org/licenses/BSD-3-Clause>. | ||
# | ||
# Address: | ||
# Plymouth Marine Laboratory | ||
# Prospect Place, The Hoe | ||
# Plymouth, PL1 3DH, UK | ||
# | ||
# Email: | ||
# ledm@pml.ac.uk | ||
# | ||
""" | ||
.. module:: tools | ||
:platform: Unix | ||
:synopsis: This uses some tools for the functions library. | ||
.. moduleauthor:: Lee de Mora <ledm@pml.ac.uk> | ||
""" | ||
|
||
ledm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
import numpy as np | ||
from bgcval2.functions.standard_functions import choose_best_var | ||
|
||
|
||
def load_area(nc): | ||
""" | ||
Generic tool for loading area: | ||
""" | ||
area_keys = ['area', 'area_grid_T', 'area_grid_W', 'area_grid_V', 'area_grid_U'] | ||
if set(area_keys).intersection(set(nc.variables.keys())): | ||
area = choose_best_var(nc, area_keys) | ||
elif set(['e1t', 'e2t']).intersection(set(nc.variables.keys())): | ||
area = nc.variables['e1t'][:]*nc.variables['e2t'][:] | ||
else: | ||
raise ValueError('Unable to load or calculate area from this file.') | ||
ledm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
return area | ||
|
Uh oh!
There was an error while loading. Please reload this page.