-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55f646b
commit 4f8e613
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ This script was tested using CHIRPS dekad data. Adjustment is needed if using ot | |
NCO (http://nco.sourceforge.net) must be installed before using this script | ||
Modified by | ||
Benny Istanto, UN World Food Programme, benny[email protected] | ||
Benny Istanto, BIGC, benny@istan.to | ||
------------------------------------------------------------------------------------------------------------- | ||
""" | ||
|
||
|
@@ -88,8 +88,9 @@ a = ds.ReadAsArray() | |
nlat,nlon = np.shape(a) | ||
|
||
b = ds.GetGeoTransform() #bbox, interval | ||
lon = np.arange(nlon)*b[1]+b[0] | ||
lat = np.arange(nlat)*b[5]+b[3] | ||
lon = np.arange(nlon)*b[1] + b[0] + (b[1]/2) # add half the x pixel size to the lon | ||
lat = np.arange(nlat)*b[5] + b[3] + (b[5]/2) # add half the y pixel size to the lat | ||
lat = np.flipud(lat) # flip the latitudes | ||
|
||
basedate = dt.datetime(1980,1,1,0,0,0) | ||
|
||
|
@@ -152,9 +153,9 @@ nco.comments = "time variable denotes the first day of the given dekad." | |
nco.website = "https://www.chc.ucsb.edu/data/chirps" | ||
nco.date_created = "2021-01-25" | ||
nco.creator_name = "Benny Istanto" | ||
nco.creator_email = "benny[email protected]" | ||
nco.institution = "UN World Food Programme" | ||
nco.note = "The data is developed to support regular updating procedure for SPI analysis (https://github.com/bennyistanto/spi). This activities will support WFP to assess extreme dry and wet periods as part of WFP's Seasonal Monitoring" | ||
nco.creator_email = "benny@istan.to" | ||
nco.institution = "Benny Istanto Geospatial Consulting" | ||
nco.note = "The data is developed to support regular updating procedure for SPI analysis (https://github.com/bennyistanto/spi). This activities will support me to assess extreme dry and wet periods as part of my Climate Social Responsibility" | ||
|
||
|
||
# Write lon,lat | ||
|
@@ -182,7 +183,7 @@ for root, dirs, files in os.walk('/path/to/directory/'): | |
print(pcp_path) | ||
pcp=gdal.Open(pcp_path) | ||
a=pcp.ReadAsArray() #data | ||
pcpo[itime,:,:]=a | ||
pcpo[itime,:,:]=np.flipud(a) # flip the data in y-direction | ||
itime=itime+1 | ||
|
||
nco.close() | ||
|
@@ -237,4 +238,4 @@ Make sure the file `java_cli_chirps_1months_1981_2020.nc` is available at `Input | |
![CHIRPS inputnc](./img/chirps-inputnc.png) | ||
- You also can get this data: `java_cli_chirps_1months_1981_2020.nc` via this link [https://github.com/bennyistanto/spi/blob/master/example/Data/Input_nc/java_cli_chirps_1months_1981_2020.nc](https://github.com/bennyistanto/spi/blob/master/example/Data/Input_nc/java_cli_chirps_1months_1981_2020.nc) | ||
- You also can get this data: `java_cli_chirps_1months_1981_2020.nc` via this link [https://github.com/bennyistanto/spi/blob/master/example/Data/Input_nc/java_cli_chirps_1months_1981_2020.nc](https://github.com/bennyistanto/spi/blob/master/example/Data/Input_nc/java_cli_chirps_1months_1981_2020.nc) |