我正在尝试使用pyresample模块绘制ASCAT海洋风向量及其wvc质量标志的完整条带轨道。可以在此处找到指向netcdf文件的ASCAT链接:ftp://podaac-ftp.jpl.nasa.gov/allData/ascat/preview/L2/metop_a/12km/ 从我在模块上阅读的文档中,它没有很好地描述我们如何在文件中找到满足几何区域定义的信息。以下是绘制一系列卫星数据的示例代码
#!/usr/bin/python
import string
import random
def brackets():
count = 0
sample = [random.choice(['[', ']', '[]']) for _ in range(random.randint(1, 10))]
sample2 =''.join([random.choice(['[', ']', '[]']) for _ in range(random.randint(1, 10))])
count1 = sample2.count('[')
count2 = sample2.count(']')
for x in sample2:
if x == "[":
count +=1
if x == "]":
count -=1
if count != 0 or count < 0 :
print "The generated sample is %s " % (sample2,)
print "There are %d [ in the generated string" % (count1,)
print "There are %d ] in the generated string" % (count2,)
print "This string is Not ok"
if count == 0 :
print "The generated sample is %s " % (sample2,)
print "There are %d [ in the generated string" % (count1,)
print "There are %d ] in the generated string" % (count2,)
print "This string is ok"
print brackets()
var queries = searchQuery.Trim().Split(' ', StringSplitOptions.RemoveEmptyEntries).Distinct();
var query = context.ReadContext.Divisions.AsQueryable();
queries.ForEach(q => {
query = query.Where(d => (d.Company.CompanyCode + "-" + d.Code).Contains(q));
});
首先,我得到一个错误,即pyresample模块没有那个属性图,当文档说它确实和&#34; area_def&#34;永远不会在ASCAT netcdf文件中的任何位置定义。对于这些类型的文件,pyresample是不合理的,还是我没有在ASCAT文件的元数据中查找这些定义的适当位置?对该模块的一些澄清确实有帮助!再次感谢!
答案 0 :(得分:0)
这里实际上有两个问题。第一个是plot
子模块。
plot
是一个子模块,可以在此处与其他子模块一起导入:
from pyresample import image, geometry, plot
其次,目标区域定义在此块中即时定义:
area_id = 'ease_sh'
name = 'Antarctic EASE grid'
proj_id = 'ease_sh'
proj4_args = 'proj=laea, lat_0=-90, lon_0=0, a=6371228.0, units=m'
x_size = 425
y_size = 425
area_extent = (-5326849.0625,-5326849.0625,5326849.0625,5326849.0625)
proj_dict = {'a': '6371228.0',
'units': 'm',
'lon_0': '0',
'proj': 'laea',
'lat_0': '-90'}
area_def = geometry.AreaDefinition(area_id,
name,
proj_id,
proj_dict,
x_size,
y_size,
area_extent)
源swath定义定义为:
swath_def = geometry.SwathDefinition(lons=lon, lats=lat)
我假设在重新采样之前已经获取了lon
和lat
数组。
PS。是的,pyresample适用于这些类型的任务。您不需要使用带有数据,经度和纬度数组的文件中的任何额外元数据就足够了。