Changeset 839 for inundation/ga/storm_surge/pyvolution/data_manager.py
- Timestamp:
- Feb 7, 2005, 5:04:54 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/data_manager.py
r837 r839 823 823 138.3698 137.4194 136.5062 135.5558 .......... 824 824 825 Convert to NetCDF pts format 825 Convert to NetCDF pts format which is 826 827 points: (Nx2) Float array 828 elevation: N Float array 826 829 """ 827 830 … … 843 846 cellsize = infile.cellsize[0] 844 847 NODATA_value = infile.NODATA_value[0] 845 elevation = infile.variables['elevation']848 dem_elevation = infile.variables['elevation'] 846 849 847 850 #Get output file … … 860 863 861 864 862 outfile.attribute_names = 'elevation' #This is the attribute always present in DEMs863 #FIXME (Ole): We would really like this to be Python list,864 #but I am not sure if865 #that is possible in NetCDF???866 867 868 865 # dimension definitions 869 866 outfile.createDimension('number_of_points', nrows*ncols) 870 outfile.createDimension('number_of_attributes', 1) #Always 1 with the dem fmt871 867 outfile.createDimension('number_of_dimensions', 2) #This is 2d data 872 868 873 874 869 # variable definitions 875 870 outfile.createVariable('points', Float, ('number_of_points', 876 871 'number_of_dimensions')) 877 outfile.createVariable('attributes', Float, ('number_of_points', 878 'number_of_attributes')) 872 outfile.createVariable('elevation', Float, ('number_of_points',)) 879 873 880 874 # Get handles to the variables 881 875 points = outfile.variables['points'] 882 attributes = outfile.variables['attributes']876 elevation = outfile.variables['elevation'] 883 877 884 878 #Store data … … 893 887 x = j*cellsize 894 888 points[index, :] = [x,y] 895 attributes[index, 0] =elevation[i, j]889 elevation[index] = dem_elevation[i, j] 896 890 897 891 infile.close()
Note: See TracChangeset
for help on using the changeset viewer.