Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14155

How to Subset Climate Data Based on Lat Long in Python?

$
0
0

Okay so this may sound too noobish but I am working on the Hunga Tonga Volcano and trying to subset different meterological datasets based on specific lat long values to create a reference climatology profile.

To be more specific, I am using the cosmic-2 atmPrf data (bending angle) to create a reference climatology profile. Now the main hurdle is the hunga tonga volcano lies on (20.5532°S, 175.3841°W) which means -20.55, -175.3841 if we are talking about a equal rectangular projection. Now I want to subset data in a -5 deg to +5 deg lat long grid and then average the values for each altitude level.

Is there anyone who can help me?

Oh and I am using python programming language

Here's what I've done so far.

def co_locate_profiles(ROprofile, interst_lat = LatBound, interest_lon = LonBound):    LatBound = [Tonglat - 5, Tonglat + 5]    LonBound = [Tonglon - 5, Tonglon + 5]       if (ROprofile.attrs["lon"] >= LonBound[0]) & (ROprofile.attrs["lon"] <= LonBound[1]) & (ROprofile.attrs["lat"] >= LatBound[0]) & (ROprofile.attrs["lat"] <= LatBound[1]):        print(f"Profile Co-Located: {ROprofile.attrs['fileStamp']} with Lat: {ROprofile.attrs['lat']} & Lon: {ROprofile.attrs['lon']}")        return ROprofile.attrs["fileStamp"]

Viewing all articles
Browse latest Browse all 14155

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>