Changeset 25178
- Timestamp:
- 06/29/20 12:39:59 (5 years ago)
- Location:
- issm/trunk-jpl/test/NightlyRun
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/test/NightlyRun/runme.py
r25168 r25178 1 1 #!/usr/bin/env python 2 import argparse 3 from glob import glob 2 4 import os 3 import argparse 5 from sys import float_info 6 from traceback import format_exc 7 4 8 import numpy as np 5 from traceback import format_exc 6 from sys import float_info 7 from glob import glob 8 from GetIds import * 9 9 10 try: 10 11 from parallelrange import parallelrange … … 12 13 import devpath 13 14 from parallelrange import parallelrange 14 from IdToName import IdToName15 15 from arch import archread 16 16 from arch import archwrite 17 from GetIds import * 18 from IdToName import IdToName 17 19 18 20 … … 182 184 # Matlab uses base 1, so use base 1 in labels 183 185 archive = np.array(archread(archive_file, archive_name + '_field' + str(k + 1))) 184 # Because np.array is weird (str(np.array(None)) becomes 'None' but np.array(None) is never equal to None, it basically becomes a type of string in an array):186 # NOTE: str(np.array(None)) becomes 'None' but np.array(None) is never equal to None: it basically becomes a type of string in an array 185 187 if str(archive) == 'None': 186 188 raise NameError("Field name '" + archive_name + '_field' + str(k + 1) + "' does not exist in archive file.") … … 196 198 #disp test result 197 199 if (np.any(error_diff > tolerance) or np.isnan(error_diff)): 198 print(('ERROR difference: { } > {} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname)))200 print(('ERROR difference: {:7.2g} > {:7.2g} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname))) 199 201 errorcount += 1 200 202 erroredtest_list.append(id) 201 203 else: 202 print(('SUCCESS difference: { } < {} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname)))204 print(('SUCCESS difference: {:7.2g} < {:7.2g} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname))) 203 205 204 206 except Exception as message: -
issm/trunk-jpl/test/NightlyRun/test2010.py
r25168 r25178 19 19 #parameterize solidearth solution: 20 20 #solidearth loading: {{{ 21 late = sum(md.mesh.lat[md.mesh.elements - 1],1) / 322 longe = sum(md.mesh.long[md.mesh.elements - 1],1) / 321 late = md.mesh.lat[md.mesh.elements - 1].sum(axis=1) / 3 22 longe = md.mesh.long[md.mesh.elements - 1].sum(axis=1) / 3 23 23 24 md.solidearth.surfaceload.icethicknesschange = np.zeros( md.mesh.numberofelements)24 md.solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, 1)) 25 25 pos = np.intersect1d(np.array(np.where(late < -75)), np.array(np.where(longe > 0))) 26 # python does not include last element in array slices,(6:7) -> [5:7]26 #NOTE: Python does not include last element in array slices: (6:7) -> [5:7] 27 27 md.solidearth.surfaceload.icethicknesschange[pos[5:7]] = -1 28 28 29 29 md.solidearth.sealevel = np.zeros(md.mesh.numberofvertices) 30 30 md.dsl.global_average_thermosteric_sea_level_change = np.zeros((2, 1)) 31 md.dsl.sea_surface_height_change_above_geoid = np.zeros( md.mesh.numberofvertices + 1)32 md.dsl.sea_water_pressure_change_at_sea_floor = np.zeros( md.mesh.numberofvertices + 1)31 md.dsl.sea_surface_height_change_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 32 md.dsl.sea_water_pressure_change_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1)) 33 33 34 34 md.solidearth.ocean_area_scaling = 1 … … 40 40 #mask: {{{ 41 41 mask = gmtmask(md.mesh.lat, md.mesh.long) 42 icemask = np.ones( md.mesh.numberofvertices)42 icemask = np.ones((md.mesh.numberofvertices, 1)) 43 43 pos = np.where(mask == 0) 44 44 icemask[pos[0]] = -1 45 pos = np.where( np.sum(mask[md.mesh.elements - 1], 1) < 3)45 pos = np.where(mask[md.mesh.elements - 1].sum(axis=1) < 3)[0] 46 46 icemask[md.mesh.elements[pos, :] - 1] = -1 47 47 md.mask.ice_levelset = icemask … … 50 50 #make sure that the elements that have loads are fully grounded 51 51 pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] 52 md.mask.ocean_levelset = -np.ones(md.mesh.numberofvertices)52 md.mask.ocean_levelset[md.mesh.elements[pos, :] - 1] = 1 53 53 54 54 #make sure wherever there is an ice load, that the mask is set to ice: 55 md.mask.ice_levelset = np.ones((md.mesh.numberofvertices, 1)) 55 56 #pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] # Do we need to do this twice? 56 md.mask.ice_levelset[md.mesh.elements[pos, :] - 1] = 1 57 58 #make sure wherever there is an ice load, that the mask is set to ice 59 md.mask.ice_levelset = np.ones(md.mesh.numberofvertices) 60 icemask[md.mesh.elements[pos, :] - 1] = -1 61 md.mask.ice_levelset = icemask 57 md.mask.ice_levelset[md.mesh.elements[pos, :] - 1] = -1 62 58 # }}} 63 59 64 60 #geometry {{{ 65 61 di = md.materials.rho_ice / md.materials.rho_water 66 md.geometry.thickness = np.ones( md.mesh.numberofvertices)67 md.geometry.surface = (1 - di) * np.zeros( md.mesh.numberofvertices)62 md.geometry.thickness = np.ones((md.mesh.numberofvertices, 1)) 63 md.geometry.surface = (1 - di) * np.zeros((md.mesh.numberofvertices, 1)) 68 64 md.geometry.base = md.geometry.surface - md.geometry.thickness 69 65 md.geometry.bed = md.geometry.base 70 66 # }}} 71 67 #materials {{{ 72 md.initialization.temperature = 273.25 * np.ones( md.mesh.numberofvertices)68 md.initialization.temperature = 273.25 * np.ones((md.mesh.numberofvertices, 1)) 73 69 md.materials.rheology_B = paterson(md.initialization.temperature) 74 md.materials.rheology_n = 3 * np.ones( md.mesh.numberofelements)70 md.materials.rheology_n = 3 * np.ones((md.mesh.numberofelements, 1)) 75 71 # }}} 76 72 #Miscellaneous {{{
Note:
See TracChangeset
for help on using the changeset viewer.