From 30e5e3f93e32128de580d6d1054745c0379faa9f Mon Sep 17 00:00:00 2001 From: MO-marcomilan Date: Tue, 11 Jan 2022 16:29:33 +0000 Subject: [PATCH] Add new yml file for variable resolution projection To run the update_uid.py under linux I should add the option shell=True in Popen --- .../regional_variable_resolution.yml | 33 +++++++++++++++++++ doc/example-grids/update_uid.py | 10 +++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 doc/example-grids/regional_variable_resolution.yml diff --git a/doc/example-grids/regional_variable_resolution.yml b/doc/example-grids/regional_variable_resolution.yml new file mode 100644 index 000000000..dd84cdf75 --- /dev/null +++ b/doc/example-grids/regional_variable_resolution.yml @@ -0,0 +1,33 @@ +# (C) Crown copyright 2022, Met Office +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# regional projection using variable resolution + +type : "regular_lonlat" +nx : 34 +ny : 32 +projection : + type: "variable_resolution" + var_ratio : 1.13 + delta_low : 1. + delta_hi : 0.6511482758621128 + x_reg_start : 351.386944827586319 + x_reg_end : 366.363355172413776 + y_reg_start : -5.008754172413662 + y_reg_end : 8.665359620690706 + startx : 348.13120344827576 + endx : 369.6190965517242 + starty : -8.264495551724226 + endy : 11.92110100000127 + north_pole : {0.0, 90.0}) + rim_widthx : 4 + rim_widthy : 4 + +check : + size : 1088 + lonlat(first) : [348.13120344827576,-8.264495551724226] + lonlat(last) : [170,11.92110100000127] + bounding_box(n,w,s,e) : [-8.264495551724226,348.13120344827576,11.92110100000127,369.6190965517242] + uid : f164da5624c5335853cdb7d5754ebd1a + diff --git a/doc/example-grids/update_uid.py b/doc/example-grids/update_uid.py index 125839888..3738c14a4 100755 --- a/doc/example-grids/update_uid.py +++ b/doc/example-grids/update_uid.py @@ -16,7 +16,8 @@ def run_program_get_error(file): from subprocess import Popen, PIPE - p = Popen(command, stdout=PIPE, stderr=PIPE) + #Marco Milan: add shell=True for run in linux + p = Popen(command, stdout=PIPE, stderr=PIPE, shell=True) output, error = p.communicate() if p.returncode != 0: return str(error.strip(),'ascii') @@ -55,14 +56,21 @@ def process_file( file, newfile ): import sys +print(sys.argv) program = sys.argv[1] print( "Updating uids of grids with program [",program,"]") import os + +print('file: ', __file__) directory = os.path.dirname(os.path.realpath(__file__)) +print('directory:', directory) + + for root, dirs, files in os.walk(directory): + print('root: ', root) for file in files: if file.endswith('.yml'): file = root+"/"+file