Changeset 19045


Ignore:
Timestamp:
01/28/15 23:25:24 (10 years ago)
Author:
dlcheng
Message:

Updated export script formatting

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/export_gl.py

    r19044 r19045  
    1010            def __getattr__(self, attr):
    1111                return self.__dict__.get(attr)
     12
    1213        print ('getting options')
    1314        templist=plotoptions(varargin);
     
    2021        directory=options.getfieldvalue('directory','./');
    2122        databasename=options.getfieldvalue('database','Pig');
    22         print(directory +databasename) 
     23       
    2324        #scaling factor:
    2425        print ('setting scaling factor')
     
    4950        R2=6371000*np.ones(len(contour_surface2))+scaling_factor*contour_surface2;
    5051
    51         contourx1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R1, contour_lat1, contour_long1);
    52         contoury1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R1, contour_lat1, contour_long1);
    53         contourz1 = map(lambda r, lat: r * math.sin(math.radians(lat)), R1, contour_lat1);
     52        model.contourx1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R1, contour_lat1, contour_long1);
     53        model.contoury1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R1, contour_lat1, contour_long1);
     54        model.contourz1 = map(lambda r, lat: r * math.sin(math.radians(lat)), R1, contour_lat1);
    5455       
    55         contourx2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R2, contour_lat2, contour_long2);
    56         contoury2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R2, contour_lat2, contour_long2);
    57         contourz2 = map(lambda r, lat: r * math.sin(math.radians(lat)), R2, contour_lat2);
    58 
    59         model.contourx1=contourx1;
    60         model.contoury1=contoury1;
    61         model.contourz1=contourz1;
    62         model.contourx2=contourx2;
    63         model.contoury2=contoury2;
    64         model.contourz2=contourz2;
    65 
     56        model.contourx2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R2, contour_lat2, contour_long2);
     57        model.contoury2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R2, contour_lat2, contour_long2);
     58        model.contourz2 = map(lambda r, lat: r * math.sin(math.radians(lat)), R2, contour_lat2);
    6659
    6760        #}}}
    6861        #Deal with mesh and results {{{
    6962        print ('getting mesh')
    70         surface=md.geometry.surface;
     63        surface=md.geometry.surface.flatten();
    7164        numberofelements=md.mesh.numberofelements;
    7265        numberofvertices=md.mesh.numberofvertices;
    73         R=6371000*np.ones(len(md.mesh.lat))+scaling_factor*surface.flatten();
     66        R=6371000*np.ones(len(md.mesh.lat))+scaling_factor*surface;
    7467       
    7568        x = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R, md.mesh.lat,md.mesh.long);
     
    9285                options=optionslist[i];
    9386                options=checkplotoptions(md,options);
    94                 data=options.getfieldvalue('data');
     87                data=options.getfieldvalue('data').flatten();
    9588                results.append(ResultObj())
    9689                results[i].data=data;
  • issm/trunk-jpl/src/m/plot/writejsfield.py

    r19044 r19045  
     1import numpy
    12def writejsfield(fid,name,variable,nods):
    23#WRITEJSFIELD - write variable to javascript file
     
    78        #write array:
    89        #if not isinstance(variable, list):
    9         if True:
     10        if type(variable[0])==numpy.float64:
    1011                fid.write('<!-- {0}{{{{{{-->\n'.format(name))
    1112                fid.write('{0}=['.format(name))
  • issm/trunk-jpl/src/m/plot/writejsfile.py

    r19044 r19045  
     1import numpy
    12from writejsfield import writejsfield
    23def writejsfile(filename,model,keyname):
     
    4748                fid.write('result["shortlabel"]="{0}";\n'.format(results[i].shortlabel))
    4849                fid.write('result["unit"]="{0}";\n'.format(results[i].unit))
    49                 if len(results[i].data[2])>1:
     50                if type(results[i].data)==numpy.float64:
    5051                        fid.write('result["time_range"]=[{0},{1}];\n'.format(results[i].time_range[0],results[i].time_range[1]))
    5152                fid.write('results["{0}"]=result;\n'.format(i))
Note: See TracChangeset for help on using the changeset viewer.