Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to find the value at certain latitude and longtitude #270

Closed
xuesongle opened this issue Apr 26, 2018 · 4 comments
Closed

How to find the value at certain latitude and longtitude #270

xuesongle opened this issue Apr 26, 2018 · 4 comments

Comments

@xuesongle
Copy link

Code Sample, a minimal, complete, and verifiable piece of code

# Your code here

from satpy.scene import Scene
from satpy.resample import get_area_def
from datetime import datetime
from glob import glob
from pyresample.utils import get_area_def

FILES = glob("/home/griffith/GIS/testData/*DAT")
scn = Scene(sensor='ahi',start_time=datetime(2018, 3, 26, 00, 00),end_time=datetime(2018, 3, 26, 00, 10),filenames=FILES,reader='ahi_hsd')

area_id = 'japan'
x_size = 2407
y_size = 1655
area_extent = (-1203877.326193321, -754860.2505908236, 1203877.3261933187, 900373.6358697552)
projection = '+proj=laea +lat_0=37.5 +lon_0=137.5 +ellps=WGS84'
description = "Japan"
proj_id = 'laea_137.5_37.5'
areadef = get_area_def(area_id, description, proj_id, projection,x_size, y_size, area_extent)
lons, lats = areadef.get_lonlats()

lat00 = lats[0,0]
lon00 = lons[0,0]


Problem description

How could I read out data at lat00,lon00 position, is there any function for it, Thanks.

Expected Output

Actual Result, Traceback if applicable

Versions of Python, package at hand and relevant dependencies

Python 3.6
Thank you for reporting an issue !

@djhoese
Copy link
Member

djhoese commented Apr 26, 2018

If you resample to that area definition then the data pixels would match the lon/lat arrays. I suggest you join the pytroll slack if you are still having trouble beyond this issue. We can give you more direct and quick help than doing github issues. See the "Getting in touch" section here: http://pytroll.github.io/

@xuesongle
Copy link
Author

@davidh-ssec Thanks, definitely I will join If I resample it as this:
local_scene = scn.resample(areadef)
local_scene.load(["B01"])
Then how could find the value from the underlying pixels here?

@djhoese
Copy link
Member

djhoese commented Apr 26, 2018

You can't load from a resampled Scene. Once you resample the Scene you can access the resampled versions of the datasets you already loaded in scn by doing:

band1 = local_scene['B01']
my_val = band1[0, 0]

@xuesongle
Copy link
Author

@davidh-ssec , Thanks a lot for your help. It does make sense now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants