This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
NAME | |
02_mxd13q1_stats_8day.py | |
MXD13Q1 8-days statistics data, long-term average, max, min and stdev | |
DESCRIPTION | |
Input data for this script will use MXD13Q1 8-days data generate from GEE or downloaded from NASA | |
This script can do 8-days statistics calculation (AVERAGE, MAXIMUM, MINIMUM and STD) | |
REQUIREMENT | |
ArcGIS must installed before using this script, as it required arcpy module. |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
NAME | |
ensemble_corrected_data.py | |
DESCRIPTION | |
Ensemble bias correction output using various methods: | |
i. Decision Tree | |
ii. Bayesian | |
iii. Random Forest | |
iv. Neural Network |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
NAME | |
imerg_cpc_biascorrection.py | |
DESCRIPTION | |
Bias correction using various methods: | |
i. Scale, | |
ii. Distribution, | |
iii. Delta, | |
iv. the Least Squares Composite differencing (LSC) |
This file contains hidden or 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 pandas as pd | |
# Load the data from the output CSV file | |
df = pd.read_csv("output.csv") | |
# Pivot the data frame to wide format for the min variable | |
min_wide = df.pivot_table(index=["lon", "lat", "orig_id", "year", "month"], columns="variable", values="value") | |
# Reset the index to obtain a flat data frame | |
min_wide = min_wide.reset_index() |
This file contains hidden or 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 pandas as pd | |
# Load the data | |
min_df = pd.read_csv("min.csv") | |
mean_df = pd.read_csv("mean.csv") | |
max_df = pd.read_csv("max.csv") | |
# Melt the data frames to long format | |
min_long = pd.melt(min_df, id_vars=["lon", "lat", "orig_id"], var_name="date", value_name="min") | |
mean_long = pd.melt(mean_df, id_vars=["lon", "lat", "orig_id"], var_name="date", value_name="mean") |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
NAME | |
taylor_diagram_outmetrics.py | |
Generate Taylor Diagram from all metrics output | |
DESCRIPTION | |
Input data for this script will use metric.csv generated by imerg_cpc_biascorrection.py. | |
REQUIREMENT | |
It required numpy, pandas, metpy, matplotlib and xarray module. So it will work on any machine environment | |
EXAMPLES |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
NAME | |
clip_netcdf_with_shp.py | |
Batch clip NetCDF in a folder with a shapefile | |
DESCRIPTION | |
Input data for this script will be NetCDF files and a shapefile in a folder | |
This script can do batch clipping of NetCDF files, and save it in seperate folder | |
REQUIREMENT | |
It required glob, xarray, rasterio and shapely module. So it will work on any machine environment |
This file contains hidden or 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 code uses the rasterio library to open the two input rasters and the scipy library | |
to perform the focal regression using the generic_filter function. The size parameter | |
specifies the size of the neighborhood around each pixel to use for the regression, | |
in this case a 3x3 window. The extra_arguments parameter is used to pass the second raster | |
to the np.polyfit function, which fits a polynomial of degree 1 (a linear regression) to | |
the two rasters. The result is a 3D array with the slope and intercept values for each pixel. | |
The code then extracts the slope and intercept arrays from the result and saves them to file | |
using rasterio. |
This file contains hidden or 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
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1958.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1959.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1960.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1961.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1962.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1963.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1964.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_ppt_1965.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/d |
This file contains hidden or 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
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1958.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1959.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1960.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1961.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1962.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1963.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1964.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/data/TerraClimate_pet_1965.nc | |
wget -c http://thredds.northwestknowledge.net:8080/thredds/fileServer/TERRACLIMATE_ALL/d |