This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL | |
image_frames = [] # creating a empty list to be appended later on | |
days = np.arange(1,365) | |
for k in days: | |
new_fram = PIL.Image.open(r'path\where\images\are\downloaded' + '\\' + str(k) + '.jpg') | |
image_frames.append(new_fram) | |
image_frames[0].save('tave_timelapse.gif',format='GIF', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this will create 365 images in the path given | |
# please set the path before executing | |
lon, lat = np.meshgrid(long,lats) | |
x,y = mp(lon,lat) | |
plt.figure(figsize=(6,8)) | |
# loop for all the days | |
days = np.arange(0,365) # for considering all days of the year | |
for i in days: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lon, lat = np.meshgrid(long,lats) #this converts coordinates into 2D arrray | |
x,y = mp(lon,lat) #mapping them together | |
plt.figure(figsize=(6,8)) #figure size | |
c_scheme = mp.pcolor(x,y,np.squeeze(tave[0,:,:]),cmap = 'jet') # [0,:,:] is for the first day of the year | |
# consider this as the outline for the map that is to be created | |
mp.drawcoastlines() | |
mp.drawstates() | |
mp.drawcountries() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mp = Basemap(projection='merc', | |
llcrnrlon=68.42, # lower longitude | |
llcrnrlat=7.45, # lower latitude | |
urcrnrlon=99.98, # uppper longitude | |
urcrnrlat=37.78, # uppper latitude | |
resolution = 'i') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lats = data.variables['lat'][:] | |
longs = data.variables['lon'][:] | |
time = data.variables['time'][:] | |
tave = data.variables['tave'][:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = '1966.nc' # mention the path to the downloaded file | |
data = Dataset(file, mode='r') # read the data | |
print(type(data)) # print the type of the data | |
print(data.variables.keys()) # print the variables in the data |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.