- ANR (31)
- HREC (1)
- SFREC (30)
- NPS (20)
- PINN (20)
- PORE
- SJER (13)
- Tahoe
- Wetland 1 (2)
- Wetland 2
Research SitesNavigationUser loginWho's onlineThere are currently 0 users and 2 guests online.
|
Batch Projection and Masking with GRASSSubmitted by dylan on Wed, 2008-05-07 18:21.
1920-1929 1930-1939 1930-1939 1940-1949 1950-1959 1960-1969 1970-1979 1980-1989 1990-1999
north: 450000 south: -650000 west: -400000 east: 600000 nsres: 4000 ewres: 4000 rows: 275 cols: 250 cells: 68750
# create a llwgs72 and teal83 location # # longlat WGS72: +proj=longlat +a=6378135 +rf=298.26 +no_defs +towgs84=0.000,0.000,5.000 # # Teal Albers NAD83: +proj=aea +lat_0=0.0000000000 +lat_1=34.0000000000 +lat_2=40.5000000000 +lon_0=-120.0000000000 +x_0=0.0000000000 +y_0=-4000000.0000000000 +a=6378137 +rf=298.257222101 +no_defs +towgs84=0.000,0.000,0.000 +to_meter=1.0000000000 # # # set region resolution to 4km, region extent to sample CIMIS raster, and copy to MASK. # loop through the list of directories for dir in 19??-19?? do echo "Processing $dir files..." cd $dir # unzip files (21 seconds per dir) # # there may be some bogus files in the lot... echo "unzipping ..." for x in *.gz ; do gunzip $x ; done # llwgs72 location # load original data (43 seconds per dir): echo "importing ..." for x in * ; do r.in.gdal --q -o in=$x out=$x --o 2>/dev/null ; done # switch to teal83 g.mapset location=teal83 mapset=PERMANENT 2>/dev/null # teal83 location # project to teal83 and MASK out everything but CA ( 37 seconds per dir): echo "projecting and masking ..." for x in * ; do r.proj --q location=llwgs72 in=$x resolution=4000 out=$x method=nearest --o 2>/dev/null ; done # save back to disk as ASCII GRID (9 seconds per dir): echo "exporting to AA GRID ..." for x in * ; do r.out.arc --q in=$x out=${x}_teal83_ca.asc 2>/dev/null ; done # archive and compress: echo "archiving output ..." tar cfz ../archive_${dir}.tar.gz *.asc && rm *.asc # clean-up echo "clean-up ..." g.mremove --q -f rast=us* 2>/dev/null ## switch back to llwgs72 g.mapset location=llwgs72 mapset=PERMANENT 2>/dev/null g.mremove --q -f rast=us* 2>/dev/null cd ../ done ( categories: )
|