Download presentation
Presentation is loading. Please wait.
Published byRichard Fletcher Modified over 6 years ago
1
Automating parflow preprocessing steps for DEMs
John A Koudelka
2
Topics Background Methods Results Conclusions Photo: John A Koudelka
3
Background ParFlow Is an integrated watershed model that simulates surface and subsurface flow. Data Processing Soil Moisture – Little Washita Watershed.
4
Methods Manual Processing Steps Automation Python (Windows)
1. Raster to ASCII 2. ASCII – No Header 3. Dataset Metrics (cell size, # rows, # columns, No Data value, x and y origin) 4. ParFlow Fortran files - Remove Pits - Create Slope Files - Generate Solid File Automation Remove pits Create Slope Files Generate Solid File Python (Windows) Python (OS X)
5
Methods Manual ASCII No Header ASCII No Pits ARC/INFO GRID ASCII
Datasets ASCII No Header ASCII No Pits ARC/INFO GRID ASCII Cell Size # Rows # Cols X origin Y origin ND Value Variables Raster To ASCII Remove Pits Create Slopes CreateSolid File Functions Remove Header X Slopes Y Slopes Solid File ParFlow Input
6
Methods Automated Raster To ASCII ASCII ARC/INFO GRID 1. X Slopes
Y Slopes Solid File ParFlow Input Remove Pits Create Slopes CreateSolid File Cell Size # Rows # Cols X origin Y origin ND Value Remove Header ASCII No Pits ASCII No Header ASCII 2.
7
Methods Challenges GDAL User Distribution Logos From:
Python – GADL - NumPy -
8
Results Processing Steps: Python Script 1 Python Script 2
import os #import numpy import subprocess ## ****** GRAB DEM PARAMS ***** ## #export raster to ascii path="/Users/johnkoudelka/ParF/Data/LittleBear/preprocess" os.chdir(path) fileName='dem.txt' outFileName='pf_dem.txt' asciiFile=open("dem.txt") rLine=asciiFile.readline().strip().split(" ") ncols=rLine[9] nrows=rLine[9] xllcorner=rLine[5] yllcorner=rLine[5] cellSize=rLine[6] NDval=rLine[2] #create the modified ascii DEM pf_ascii=open(outFileName,'w') i=0 #write it while (i<int(nrows)): rLine=asciiFile.readline() pf_ascii.write(rLine +'\n’) i=i+1 Processing Steps: Python Script 1 Raster to ASCII conversion Python Script 2 Set header information to variables Write DEM without header information Execute modified Fortran codes Script 2 – Code Snieppet
9
Conclusions Automation Future work Fortran & Python Computing Platform
GDAL Photo: John A Koudelka
10
The End Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.