Changeset 21568
- Timestamp:
- 02/21/17 05:11:08 (8 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/clusters/vilje.py
r21425 r21568 117 117 fid.close() 118 118 119 119 # }}} 120 120 def UploadQueueJob(self,modelname,dirname,filelist): 121 121 # {{{ 122 123 122 #compress the files into one zip. 124 123 compressstring='tar -zcf %s.tar.gz ' % dirname -
issm/trunk-jpl/src/m/contrib/defleurian/paraview/exportVTK.py
r21303 r21568 40 40 os.mkdir(filename) 41 41 42 # get the element related variables42 # {{{ get the element related variables 43 43 if 'z' in dict.keys(model.mesh.__dict__): 44 44 points=np.column_stack((model.mesh.x,model.mesh.y,model.mesh.z)) … … 51 51 num_of_elt=np.shape(model.mesh.elements)[0] 52 52 point_per_elt=np.shape(model.mesh.elements)[1] 53 54 # Select the type of element function of the number of nodes per elements53 # }}} 54 # {{{ Select the type of element function of the number of nodes per elements 55 55 if point_per_elt==3: 56 56 celltype=5 #triangles … … 59 59 else: 60 60 error('Your Element definition is not taken into account \n') 61 62 # this is the result structure61 # }}} 62 # {{{ this is the result structure 63 63 res_struct=model.results 64 64 if (len(res_struct.__dict__)>0): … … 75 75 else: 76 76 num_of_timesteps=1 77 77 # }}} 78 # {{{ write header and mesh 78 79 for step in range(0,num_of_timesteps): 79 80 timestep=step … … 107 108 108 109 fid.write('POINT_DATA %s \n' %str(num_of_points)) 109 110 # loop over the different solution structures110 # }}} 111 # {{{ loop over the different solution structures 111 112 if 'solnames' in locals(): 112 113 for sol in solnames: … … 141 142 else: 142 143 fid.write('%e\n' % fieldstruct[node]) 143 144 #loop on arguments, if something other than result is asked, do 145 #it now 144 # }}} 145 # {{{ loop on arguments, if something other than result is asked, do it now 146 146 for other in args: 147 147 other_struct=model.__dict__[other] 148 148 othernames=(dict.keys(other_struct.__dict__)) 149 149 for field in othernames: 150 if ((np.size(other_struct.__dict__[field]))==num_of_points): 151 fid.write('SCALARS %s float 1 \n' % field) 152 fid.write('LOOKUP_TABLE default\n') 153 for node in range(0,num_of_points): 154 #paraview does not like NaN, replacing 155 if np.isnan(other_struct.__dict__[field][node]): 156 fid.write('%e\n' % -9999.9999) 157 #also checking for verry small value that mess up 158 elif (abs(other_struct.__dict__[field][node])<1.0e-20): 159 fid.write('%e\n' % 0.0) 150 if np.ndim(other_struct.__dict__[field])==1: 151 if np.size(other_struct.__dict__[field])==num_of_points: 152 fid.write('SCALARS %s float 1 \n' % field) 153 fid.write('LOOKUP_TABLE default\n') 154 for node in range(0,num_of_points): 155 #paraview does not like NaN, replacing 156 if np.isnan(other_struct.__dict__[field][node]): 157 fid.write('%e\n' % -9999.9999) 158 #also checking for verry small value that mess up 159 elif (abs(other_struct.__dict__[field][node])<1.0e-20): 160 fid.write('%e\n' % 0.0) 161 else: 162 fid.write('%e\n' % other_struct.__dict__[field][node]) 163 elif np.ndim(other_struct.__dict__[field])==2: 164 #deal with forcings 165 if np.shape(other_struct.__dict__[field])[0]==num_of_points+1: 166 current_time=res_struct.__dict__[sol].__getitem__(timestep).__dict__['time']/model.__dict__['constants'].__dict__['yts'] 167 times=other_struct.__dict__[field][-1,:] 168 if np.any(times==current_time): 169 time_loc=np.where(times==current_time) 170 current_force=other_struct.__dict__[field][:-1,time_loc] 160 171 else: 161 fid.write('%e\n' % other_struct.__dict__[field][node]) 172 precede_time_loc=np.where(times<current_time)[0][-1] 173 follow_time_loc=np.where(times>current_time)[0][0] 174 time_scaling=(current_time-times[precede_time_loc])/(times[follow_time_loc]-times[precede_time_loc]) 175 current_force=other_struct.__dict__[field][:-1,precede_time_loc]+(other_struct.__dict__[field][:-1,follow_time_loc]-other_struct.__dict__[field][:-1,precede_time_loc])*time_scaling 176 fid.write('SCALARS %s float 1 \n' % field) 177 fid.write('LOOKUP_TABLE default\n') 178 for node in range(0,num_of_points): 179 #paraview does not like NaN, replacing 180 if np.isnan(current_force[node]): 181 fid.write('%e\n' % -9999.9999) 182 #also checking for verry small value that mess up 183 elif (abs(current_force[node])<1.0e-20): 184 fid.write('%e\n' % 0.0) 185 else: 186 fid.write('%e\n' % current_force[node]) 187 # reloaded variable are generally of dim 2 188 elif np.shape(other_struct.__dict__[field])[0]==num_of_points: 189 fid.write('SCALARS %s float 1 \n' % field) 190 fid.write('LOOKUP_TABLE default\n') 191 for node in range(0,num_of_points): 192 #paraview does not like NaN, replacing 193 if np.isnan(other_struct.__dict__[field][node]): 194 fid.write('%e\n' % -9999.9999) 195 #also checking for verry small value that mess up 196 elif (abs(other_struct.__dict__[field][node])<1.0e-20): 197 fid.write('%e\n' % 0.0) 198 else: 199 fid.write('%e\n' % other_struct.__dict__[field][node]) 200 # }}} 162 201 fid.close(); -
issm/trunk-jpl/src/m/io/loadvars.py
r21358 r21568 106 106 Tree=nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] 107 107 else: 108 108 curclass=NCFile.groups[classtree[mod][0]] 109 109 nvdict['md'].__dict__[mod] = getattr(classtype[mod][1],classtype[mod][0])() 110 110 Tree=nvdict['md'].__dict__[classtree[mod][0]]
Note:
See TracChangeset
for help on using the changeset viewer.