Changeset 19045
- Timestamp:
- 01/28/15 23:25:24 (10 years ago)
- 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 10 10 def __getattr__(self, attr): 11 11 return self.__dict__.get(attr) 12 12 13 print ('getting options') 13 14 templist=plotoptions(varargin); … … 20 21 directory=options.getfieldvalue('directory','./'); 21 22 databasename=options.getfieldvalue('database','Pig'); 22 print(directory +databasename)23 23 24 #scaling factor: 24 25 print ('setting scaling factor') … … 49 50 R2=6371000*np.ones(len(contour_surface2))+scaling_factor*contour_surface2; 50 51 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); 54 55 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); 66 59 67 60 #}}} 68 61 #Deal with mesh and results {{{ 69 62 print ('getting mesh') 70 surface=md.geometry.surface ;63 surface=md.geometry.surface.flatten(); 71 64 numberofelements=md.mesh.numberofelements; 72 65 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; 74 67 75 68 x = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R, md.mesh.lat,md.mesh.long); … … 92 85 options=optionslist[i]; 93 86 options=checkplotoptions(md,options); 94 data=options.getfieldvalue('data') ;87 data=options.getfieldvalue('data').flatten(); 95 88 results.append(ResultObj()) 96 89 results[i].data=data; -
issm/trunk-jpl/src/m/plot/writejsfield.py
r19044 r19045 1 import numpy 1 2 def writejsfield(fid,name,variable,nods): 2 3 #WRITEJSFIELD - write variable to javascript file … … 7 8 #write array: 8 9 #if not isinstance(variable, list): 9 if True:10 if type(variable[0])==numpy.float64: 10 11 fid.write('<!-- {0}{{{{{{-->\n'.format(name)) 11 12 fid.write('{0}=['.format(name)) -
issm/trunk-jpl/src/m/plot/writejsfile.py
r19044 r19045 1 import numpy 1 2 from writejsfield import writejsfield 2 3 def writejsfile(filename,model,keyname): … … 47 48 fid.write('result["shortlabel"]="{0}";\n'.format(results[i].shortlabel)) 48 49 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: 50 51 fid.write('result["time_range"]=[{0},{1}];\n'.format(results[i].time_range[0],results[i].time_range[1])) 51 52 fid.write('results["{0}"]=result;\n'.format(i))
Note:
See TracChangeset
for help on using the changeset viewer.