|
POST
|
I have a couple little streams. I have a DEM I created a Flow Direction from the DEM I now want to create a Raster of all area above the streams. I did a Basin but that seems to give me data below the streams as well as this is based off of the DEM and not looking at the Stream Segments. I don't have to use the Streams per say...I can use a point along the stream and then I want to create a raster of the area upstream of that point. Thoughts?
... View more
12-06-2016
06:08 AM
|
0
|
5
|
6042
|
|
POST
|
just seems very hands on and manual.....the python script I have working is fully automated and does all of that....run it on a scheduled task and leave it. have any questions let me know....good luck
... View more
11-28-2016
10:16 AM
|
0
|
1
|
2151
|
|
POST
|
Tucker Are you trying to reproduce what I was working on earlier in the post or working from Callum's post? I can explain further and post full working of the export I was able to get working... I am still getting an error of some sort but everything seems to be working. See my last post above...didn't hear back from James Tedrick for a potential solution to the last error...but things are working for me regardless of the error... And THANK you again James for your help.
... View more
11-28-2016
09:50 AM
|
0
|
3
|
2151
|
|
POST
|
THANKS DAN....that worked great....still learning day by day here.....have a great Thanksgiving.
... View more
11-23-2016
08:48 AM
|
0
|
1
|
1281
|
|
POST
|
I have two expressions that work independently but cant get the syntax correct to put them together. expression1 = "trailblazers = 'No' OR regulations = 'No' OR safteysign = 'No'" expression2 = "date >= " + "'%s'" %startdate + " AND " + "date <= " + "'%s'" %enddate I tried this: expression3 = expression2 + ' AND ' + expression1 expression3 = expression2 + " AND " + expression1 expression3 = "date >= " + "'%s'" %startdate + " AND " + "date <= " + "'%s'" %enddate + " AND " + "trailblazers = 'No' OR regulations = 'No' OR safteysign = 'No'" When I run expression3 it seems to ignore expression2 and gives me all the dates not the ones specified. Confused because when I run expression1 and expression2 individually they do their job. Thoughts?
... View more
11-23-2016
08:12 AM
|
0
|
4
|
1538
|
|
POST
|
I stripped down a bunch of characters from the Header...it appears to be working now...definitely think I was hitting some sort of Character limit...I thank you very much for you help...spent way to long on this already...seems to be working...just watch how many characters I have from now on....
... View more
11-22-2016
01:03 PM
|
0
|
0
|
472
|
|
POST
|
Excel 2010... Yea something weird is going on...If I copy the created .csv file from my server to my PC, then go File>open (not drag and drop it woks fine). Drag and drop it carries to the next line. But that only works once....then it gets all screwed up again...Very puzzled...going to try and decrease the characters being used in the header to see if that helps.
... View more
11-22-2016
12:56 PM
|
0
|
0
|
472
|
|
POST
|
I think I am running into this issue....researching now... Maximum length of CSV file
... View more
11-22-2016
12:51 PM
|
0
|
0
|
3484
|
|
POST
|
When i use 3 it places them in the correct location. When I use all 78 it gets to a point it cuts off the text between the ' ' It then throws the rest of what go cut off to the next line and then all the others that follow are placed in the proper locations albeit in the 2nd row. It appears that I am hitting some sort of character limit in the CSV as it returns to the next line for the header....too many characters? See attached csv and excel file outputs.
... View more
11-22-2016
12:38 PM
|
0
|
4
|
3484
|
|
POST
|
I changed to that...but when using the below it writes header values to the 1st and 2nd line. NOTE: I have 78 fields. The header line below is just showing 3. Might be hitting a limit in Excel from a CSV file? headers = ["region_1,county_1,ramp_1,date,"]
... View more
11-22-2016
12:22 PM
|
0
|
6
|
3484
|
|
POST
|
I have one last issue. I have many many fields...when I write the header in it writes to the second line when I bring the csv into excel. BUT the data that I am writing to the same csv file does not. The individual records are all on the same line. Why is this? Can I specify to not return to the 2nd line ?
... View more
11-22-2016
12:07 PM
|
0
|
0
|
3484
|
|
POST
|
I got it...answered my own question! Just added , inside the quotes. headers = ['region_1,','county_1,','ramp_1,']
... View more
11-22-2016
11:52 AM
|
0
|
9
|
3484
|
|
POST
|
I am creating a csv file via the SearchCursor. This Works great....although I am not getting the field names in there. I went about this 2 ways. I have tried a ton of forums but just cant seem to get the right syntax to create this ONLY once and when I bring it into Excel it has a header for each field. Any thoughts? I add the headers IN the "for row in cursor" This adds them BUT it creates a set of headers for each record imported with arcpy.da.SearchCursor(fc, [var_region_1 ,var_county_1,var_ramp_1], where_clause=expression) as cursor:
for row in cursor:
zval = str('{0},{1},{2}'.format(row[0],row[1],row[2]))
headers = ['region_1','county_1','ramp_1']
outFile.write('\t'.join(headers) + '\n')
outFile.write(zval + "%s\n")
Add headers BEFORE the "for row in cursor" This adds them but when I bring into excel they are all crammed into the first box, not spread out for each field. headers = ['region_1','county_1','ramp_1']
outFile.write('\t'.join(headers) + '\n')
with arcpy.da.SearchCursor(fc, [var_region_1 ,var_county_1,var_ramp_1], where_clause=expression) as cursor:
for row in cursor:
zval = str('{0},{1},{2}'.format(row[0],row[1],row[2]))
outFile.write(zval + "%s\n")
... View more
11-22-2016
11:44 AM
|
0
|
11
|
8368
|
|
POST
|
I was all over that example earlier...just could not get the syntax right.... Think I got it running...Is there a way to release the txt document after I run the code? The only way I can delete it is if I close my Python Window. On Delete attempt I get "The Action cant be completed because the file is open in pythonw.exe" Working Code: filename = "TestFile.txt"
f = file(filename)
#===SET EMAIL To AND From==============================
FROMADDR = "[email protected]"
TOADDRS = ["[email protected]"]
#===BUILD EMAIL========================================
def msgEmail():
#msg = "Test"
msg = MIMEMultipart()
#msg = "Test"
body = "This is the message"
content = MIMEText(body, 'plain')
attachment = MIMEText(f.read())
attachment.add_header('Content-Disposition', 'attachment', filename=filename)
msg.attach(attachment)
server = smtplib.SMTP('smtp0.xx.com',25)
server.set_debuglevel(1)
server.ehlo()
#server.sendmail(FROMADDR, TOADDRS, msg)
server.sendmail(FROMADDR, TOADDRS, msg.as_string())
server.quit()
return "Email Sent but Import Aborted"
#===PROCESS EMAIL======================================
getMsgP = msgEmail()
print getMsgP
... View more
11-21-2016
01:47 PM
|
0
|
1
|
3173
|
|
POST
|
#===BUILD EMAIL========================================
def msgEmail():
#msg = "Test"
msg = MIMEMultipart()
msg = "Test"
part = MIMEBase('application', "octet-stream")
part.set_payload(open("TestFile.txt", "rb").read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="TestFile.txt"')
msg.attach(part)
server = smtplib.SMTP('smtp0.xx.com',25)
server.set_debuglevel(1)
server.ehlo()
#server.sendmail(FROMADDR, TOADDRS, msg)
server.sendmail(FROMADDR, TOADDRS, msg.as_string())
server.quit()
return "Email Sent but Import Aborted"
#===PROCESS EMAIL======================================
getMsgP = msgEmail()
print getMsgP
... View more
11-21-2016
01:19 PM
|
0
|
3
|
3173
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|