Changeset 21568


Ignore:
Timestamp:
02/21/17 05:11:08 (8 years ago)
Author:
bdef
Message:

CHG:minor typo fix

Location:
issm/trunk-jpl/src/m
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/clusters/vilje.py

    r21425 r21568  
    117117                fid.close()
    118118
    119                 # }}}
     119                # }}}
    120120        def UploadQueueJob(self,modelname,dirname,filelist):
    121121                # {{{
    122 
    123122                #compress the files into one zip.
    124123                compressstring='tar -zcf %s.tar.gz ' % dirname
  • issm/trunk-jpl/src/m/contrib/defleurian/paraview/exportVTK.py

    r21303 r21568  
    4040                os.mkdir(filename)
    4141
    42         #get the element related variables
     42        # {{{ get the element related variables
    4343        if 'z' in dict.keys(model.mesh.__dict__):
    4444                points=np.column_stack((model.mesh.x,model.mesh.y,model.mesh.z))
     
    5151        num_of_elt=np.shape(model.mesh.elements)[0]
    5252        point_per_elt=np.shape(model.mesh.elements)[1]
    53                
    54         #Select the type of element function of the number of nodes per elements
     53        # }}}
     54        # {{{ Select the type of element function of the number of nodes per elements
    5555        if point_per_elt==3:
    5656                celltype=5 #triangles
     
    5959        else:
    6060                error('Your Element definition is not taken into account \n')
    61 
    62         #this is the result structure
     61        # }}}
     62        # {{{ this is the result structure
    6363        res_struct=model.results
    6464        if (len(res_struct.__dict__)>0):
     
    7575        else:
    7676                num_of_timesteps=1
    77 
     77        # }}}
     78        # {{{ write header and mesh
    7879        for step in range(0,num_of_timesteps):
    7980                timestep=step
     
    107108
    108109                fid.write('POINT_DATA %s \n' %str(num_of_points))
    109        
    110                 #loop over the different solution structures
     110                # }}}
     111                # {{{ loop over the different solution structures
    111112                if 'solnames' in locals():
    112113                        for sol in solnames:
     
    141142                                                        else:
    142143                                                                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
    146146                for other in args:
    147147                        other_struct=model.__dict__[other]
    148148                        othernames=(dict.keys(other_struct.__dict__))
    149149                        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]
    160171                                                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                # }}}
    162201        fid.close();
  • issm/trunk-jpl/src/m/io/loadvars.py

    r21358 r21568  
    106106                                        Tree=nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
    107107                        else:
    108                                 curclass=NCFile.groups[classtree[mod][0]]
     108                                curclass=NCFile.groups[classtree[mod][0]]
    109109                                nvdict['md'].__dict__[mod] = getattr(classtype[mod][1],classtype[mod][0])()
    110110                                Tree=nvdict['md'].__dict__[classtree[mod][0]]
Note: See TracChangeset for help on using the changeset viewer.