[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    [postgis-users] raster2pgsql command expansion issue?
From:       J Payne <jcpayne () uw ! edu>
Date:       2017-08-03 23:02:47
Message-ID: 94FC86E6-208B-433D-A1CB-E16C75E5F85E () uw ! edu
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I have been attempting to load a stack of rasters into PostGIS from a set of netcdf \
files.   

 

I can load the files *individually* perfectly well.   This works:

 

                               raster2pgsql -s 4326 -I -C -F -t 256x256 \
NETCDF:"/myPath/myFile.nc":var myTable | psql (etc.) #SUCCEEDS ("var" is the netcdf \
variable of interest)

 

…but if I try to process *all* the files in the directory, using a wildcard, the \
"NETCDF:file:var" expression apparently doesn't expand properly and it fails (I've \
tried it with quotes and that fails too).

                               raster2pgsql -s 4326 -I -C -F -t 256x256 \
NETCDF:/myPath/*.nc:var myTable | psql (etc.)         #FAILS

raster2pgsql -s 4326 -I -C -F -t 256x256 NETCDF:"/myPath/*.nc":var myTable | psql \
(etc.) #FAILS

 

I've figured out a workaround using a bash script to append files one at a time, but \
it's sort of annoying that the one-liner fails when it seems to be so close to \
working.   It seems like it might just be a bash expansion problem—does anyone know \
for sure? 

 

Thanks!

 

John Payne

 


[Attachment #5 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Title content=""><meta \
name=Keywords content=""><meta http-equiv=Content-Type content="text/html; \
charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered \
medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:Calibri;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Calibri;
	color:windowtext;}
span.msoIns
	{mso-style-type:export-only;
	mso-style-name:"";
	text-decoration:underline;
	color:teal;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:Calibri;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style></head><body bgcolor=white lang=EN-US link="#0563C1" vlink="#954F72"><div \
class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt'>I have been \
attempting to load a stack of rasters into PostGIS from a set of netcdf files.   \
<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt'>I can load the files *<b>individually</b>* perfectly well.   \
This works:<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt'>                               raster2pgsql -s 4326 -I -C -F \
-t 256x256 NETCDF:&#8221;/myPath/myFile.nc&#8221;:var myTable | psql (etc.) #SUCCEEDS \
(&#8220;var&#8221; is the netcdf variable of interest)<o:p></o:p></span></p><p \
class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span style='font-size:11.0pt'>&#8230;but if I try to process \
*<b>all</b>* the files in the directory, using a wildcard, the \
&#8220;NETCDF:file:var&#8221; expression apparently doesn&#8217;t expand properly and \
it fails (I&#8217;ve tried it with quotes and that fails \
too).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>         \
raster2pgsql -s 4326 -I -C -F -t 256x256 NETCDF:/myPath/*.nc:var myTable | psql \
(etc.)         #FAILS<o:p></o:p></span></p><p class=MsoNormal \
style='text-indent:.5in'><span style='font-size:11.0pt'>raster2pgsql -s 4326 -I -C -F \
-t 256x256 NETCDF:&#8221;/myPath/*.nc&#8221;:var myTable | psql (etc.) \
#FAILS<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt'>I&#8217;ve figured out a workaround using a bash script to \
append files one at a time, but it&#8217;s sort of annoying that the one-liner fails \
when it seems to be so close to working.   It seems like it might just be a bash \
expansion problem&#8212;does anyone know for sure? <o:p></o:p></span></p><p \
class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span style='font-size:11.0pt'>Thanks!<o:p></o:p></span></p><p \
class=MsoNormal><span style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span style='font-size:11.0pt'>John Payne<o:p></o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></p></div></body></html>


[Attachment #6 (text/plain)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic