modelprop.py
def _write_schema(self, metadata, data, output_file):
        '''
        write fragility/vulnerability schema to a json file.
        the file contains two dictionaries: 
        1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
           damage states
        2) 'data' provides the mean and log. std deviation of the lognormal
           distribution encoding the fragility / vulnerability descriptions
        the function accepts a dictionary with metadata and a pandas dataframe
        '''
        if ((metadata is not None) and (data is not None)):
            modict = {}
            modict['meta'] = metadata
            #data should be a pandas dataframe
            modict['data'] = data.to_dict(orient='records')
            with open(output_file,'w') as f:
                json.dump(modict,f, indent=4)
            return (0)
        else:
            print ("_write_schema: metadata or data are missing.")
            return(1)

        write fragility/vulnerability schema to a json file.
        the file contains two dictionaries: 
        1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
           damage states
        2) 'data' provides the mean and log. std deviation of the lognormal
           distribution encoding the fragility / vulnerability descriptions
        the function accepts a dictionary with metadata and a pandas dataframe
        
write fragility/vulnerability schema to a json file.
the file contains two dictionaries:
1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
damage states
2) 'data' provides the mean and log. std deviation of the lognormal
distribution encoding the fragility / vulnerability descriptions
the function accepts a dictionary with metadata and a pandas dataframe
write fragility / vulnerability schema to a json file . the file contains two dictionaries : 1 ) ' meta ' includes information ( metadata ) on the schema the list of taxonomies and damage states 2 ) ' data ' provides the mean and log . std deviation of the lognormal distribution encoding the fragility / vulnerability descriptions the function accepts a dictionary with metadata and a pandas dataframe
def _write_schema(self, metadata, data, output_file):
        if ((metadata is not None) and (data is not None)):
            modict = {}
            modict['meta'] = metadata
            modict['data'] = data.to_dict(orient='records')
            with open(output_file,'w') as f:
                json.dump(modict,f, indent=4)
            return (0)
        else:
            print ("_write_schema: metadata or data are missing.")
            return(1)
def _write_schema ( self , metadata , data , output_file ) : if ( ( metadata is not None ) and ( data is not None ) ) : modict = { } modict [ 'meta' ] = metadata modict [ 'data' ] = data . to_dict ( orient = 'records' ) with open ( output_file , 'w' ) as f : json . dump ( modict , f , indent = 4 ) return ( 0 ) else : print ( "_write_schema: metadata or data are missing." ) return ( 1 )
write fragility/vulnerability schema to a json file.
write fragility / vulnerability schema to a json file .
'''
        write fragility/vulnerability schema to a json file.
        the file contains two dictionaries: 
        1) 'meta' includes information (metadata) on the schema, the list of taxonomies and
           damage states
        2) 'data' provides the mean and log. std deviation of the lognormal
           distribution encoding the fragility / vulnerability descriptions
        the function accepts a dictionary with metadata and a pandas dataframe
        ''' #data should be a pandas dataframe
self
metadata
data
output_file