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
#!/usr/bin/env groovy | |
import javax.mail.internet.MimeBodyPart | |
import javax.mail.internet.MimeMultipart | |
import javax.activation.URLDataSource | |
def address = "http://example.com/cgi-bin/public/ms/gcv4/F16_2010_blended.lzw.tif?request=GetCoverage&service=WCS&version=1.1.1&COVERAGE=F16_2010_blended.lzw.tif&crs=EPSG:4326&format=geotiff&resx=0.0083333333&resy=0.0083333333&bbox=-95,25,-75,40" | |
def url = address.toURL() | |
HttpURLConnection connection = url.openConnection() | |
URLDataSource dataSource = new URLDataSource(url) | |
MimeMultipart multipart = new MimeMultipart(dataSource) |
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
def roundDown(Double value, Integer interval) { | |
if (interval == null || interval <= 0) { | |
throw new IllegalArgumentException("Interval must be > 0") | |
} | |
return Math.floor(value/interval)*interval | |
} | |
def Integer roundUp(Double value, Integer interval) { | |
if (interval == null || interval <= 0) { |
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
import com.vividsolutions.jts.geom.Geometry | |
import com.vividsolutions.jts.io.WKTReader | |
def WKTReader wktReader = new WKTReader() | |
def clip = wktReader.read("POLYGON((-10 -10, 10 -10, 10 10, -10 10,-10 -10))") | |
def line = wktReader.read("MULTILINESTRING((-15 -20, 15 20),(9 -30, 9 30))") | |
//def line = wktReader.read("MULTILINESTRING((-15 -20, 15 20))") | |
//def line = wktReader.read("MULTILINESTRING((0 -20, 0 20),(2 -30, 2 30))") |
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
def String getWmsUrl(url) { | |
def parser = new org.cyberneko.html.parsers.SAXParser() | |
parser.setFeature('http://xml.org/sax/features/namespaces', false) | |
def page = new XmlParser(parser).parse("${url}/MapServer?f=html") | |
def data = page.depthFirst().A.'@href'.grep{ it != null && it.endsWith('WMS') } | |
if (data) { | |
return data[0] | |
} else { | |
return null | |
} |
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
import ucar.nc2.dataset.NetcdfDataset | |
import ucar.nc2.dt.GridCoordSystem | |
//import org.apache.log4j.* | |
//Logger log = Logger.getInstance("netcdf") | |
String filename = "http://motherlode.ucar.edu:8080/thredds/dodsC/fmrc/NCEP/GFS/CONUS_80km/runs/NCEP-GFS-CONUS_80km_RUN_2011-03-20T18:00:00Z.nc" | |
//http://motherlode.ucar.edu:8080/thredds/dodsC/model/NCEP/GFS/CONUS_80km/GFS_CONUS_80km_20061019_0000.grib1"; | |
NetcdfDataset ncd = null; | |
try { |
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
import ucar.nc2.NetcdfFile | |
import ucar.nc2.dataset.NetcdfDataset | |
String filename = "/Users/jcc/testme.grd"; | |
def NetcdfFile ncfile = null; | |
try { | |
ncfile = NetcdfFile.open(filename) | |
def minZ = ncfile.findVariable("z").findAttribute("actual_range").getValue(0) | |
def maxZ = ncfile.findVariable("z").findAttribute("actual_range").getValue(1) |
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
import com.vividsolutions.jts.linearref.LengthIndexedLine | |
import com.vividsolutions.jts.io.WKTReader | |
def reader = new WKTReader() | |
def line = reader.read("LINESTRING(10 10, -10 -10)") | |
def lil = new LengthIndexedLine(line) | |
def increment = 2 |
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
out.println("Free Memory: "+Runtime.getRuntime().freeMemory()+"<br>"); | |
out.println("Max Memory: "+Runtime.getRuntime().maxMemory()+"<br>"); | |
out.println("Total Memory: "+Runtime.getRuntime().totalMemory()+"<br>"); |
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
import numpy,os | |
from osgeo import osr, gdal | |
nx = 361 | |
ny = 181 | |
output_file = "calibration_1deg.tiff" | |
driver = gdal.GetDriverByName("GTiff") | |
dst_ds = driver.Create(output_file, nx, ny, 1, gdal.GDT_Int16) |
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
repositories { | |
mavenCentral() | |
} | |
configurations { | |
dijits | |
} | |
dependencies { | |
compile 'org.codehaus.groovy:groovy-all:2.3.6' | |
dijits 'commons-io:commons-io:2.4' |
OlderNewer