Пример #1
0
verbose = True

print(sys.argv, year, country_code)

### get land cover data

fname = f'data/landcover_{year}_{country_code}.npz'

ofile = Path('data') / fname
done = False

if ofile.exists():
    done = True

# try to download it from server
done = procure_dataset(fname, verbose=True)

from geog0111.get_modis_files import get_modis_files
from geog0111.process_timeseries import mosaic_and_clip
'''
Get the MODIS LC files from the server
to store in data
'''
if not done:
    try:
        url = 'https://e4ftl01.cr.usgs.gov//MODV6_Cmp_C/MOTA/'
        filename = get_modis_files(1,year,[tiles],base_url=url,\
                                                   version=6,verbose=True,\
                                                   destination_folder='data',\
                                                   product='MCD12Q1')[0]
        print(filename)
Пример #2
0
x = np.arange(-3*sigma,3*sigma+1)
gaussian = np.exp((-(x/sigma)**2)/2.0)

FIPS = country_code
dates, lai_array, weights_array = lai['dates'],lai['lai'],lai['weights']
print(lai_array.shape, weights_array.shape) #Check the output array shapes

from geog0111.geog_data import procure_dataset
import numpy as np
from pathlib import Path

'''
LAI data
'''
# read in the LAI data for given country code
lai_filename = f'data/lai_data_{year}_{country_code}.npz'
# get the dataset in case its not here
procure_dataset(Path(lai_filename).name,verbose=False)

lai = np.load(lai_filename)
print(lai_filename,list(lai.keys()))

'''
T 2m data
'''
t2_filename = f'data/europe_data_{year}_{country_code}.npz'
# get the dataset in case its not here
procure_dataset(Path(t2_filename).name,verbose=False)
t2data = np.load(t2_filename)
print(t2_filename,list(t2data.keys()))
Пример #3
0
import sys
year = 2017
if len(sys.argv) == 3:
    country_code = sys.argv[1]
    year = int(sys.argv[2])
elif len(sys.argv) == 2:
    country_code = sys.argv[1]
else:
    country_code = 'UK'
verbose = True

print(sys.argv,year,country_code)

files = list(Path('data').glob('MCD15A3H.A201[6-7]*h1[7-8]v0[3-4].006*hdf'))
if len(files) < 732:
    _ = procure_dataset("lai_files",verbose=False)

# Get the shapefile for country borders
import requests
import shutil
from pathlib import Path

force = False
# zip file
zipfile = 'TM_WORLD_BORDERS-0.3.zip'
# URL
tm_borders_url = f"http://thematicmapping.org/downloads/{zipfile}"
# destibnation folder
destination_folder = Path('data')

# set up some filenames