1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| conda install -c stcorp harp -y sudo apt install harp conda install gdal -y
harpconvert -a 'keep(latitude_bounds,longitude_bounds,nitrogendioxide_tropospheric_column);bin_spatial(2400,-37,0.01,3300,-83,0.01);squash(time, (latitude_bounds,longitude_bounds));derive(latitude {latitude});derive(longitude {longitude});exclude(latitude_bounds,longitude_bounds,count,weight)' no2.nc xx1.nc
全球经纬度的取值范围为:纬度-90至90,经度-180至180 中国的经纬度范围大约为:纬度3.86至53.55,经度73.66至135.05 纬度1度 = 大约111km 纬度1分 = 大约1.85km
坐标换算
bin_spatial(181,-90,1,361,-180,1): latitude starts at -90 with 1 degree steps (ending up after (181 - 1) steps at 90) and longitude starts at -180 with 1 degree steps (ending up after (361 - 1) steps at 180)
1 degree
0.1 degree, 6'=10km
# harpconvert -a 'keep(latitude_bounds,longitude_bounds,tropospheric_NO2_column_number_density);bin_spatial(1801,-90,0.1,3601,-180,0.1);squash(time, (latitude_bounds,longitude_bounds));derive(latitude {latitude});derive(longitude {longitude});exclude(latitude_bounds,longitude_bounds,count,weight)' no2.nc f6.nc
0.05 degree, 3'=5km
gdal_translate -a_srs EPSG:4326 -of GTiff NETCDF:"C:\Users\liupei\Desktop\no2\2019\S5P_OFFL_L2__NO2____20190301T031704_20190301T045834_07147_01_010202_20190307T050828.nc.nc":tropospheric_NO2_column_number_density C:/Users/liupei/Desktop/no2/2019/hello.tif
import gdal dataset = gdal.Open("f3_S5P_OFFL_L2__NO2____20190301T031704_20190301T045834_07147_01_010202_20190307T050828.nc.tif")
gt = dataset.GetGeoTransform() gt gt[1] gt[2] gt[4] gt[5] gt[0] gt[3]
dataset.RasterCount band = dataset.GetRasterBand(1) dataset.RasterXSize dataset.RasterYSize
dataset.ReadAsArray(500,500,10,10) dir(band) band.XSize band.YSize band.DataType import gdalconst dir(gdalconst)
band.GetNoDataValue() band.GetMaximum() band.GetMinimum() band.ComputeRasterMinMax()
band.GetRasterColorInterpretation() gdalconst.GCI_PaletteIndex colormap = band.GetRasterColorTable() dir(colormap)
|