sum() with raster::aggregate() in R

If you try to use sum() directly in raster::aggregate() and have NA values, you’ll get NA as a result. You need to build a tiny function and pass the rm.na=T command to sum(). More succintly:

# Dissolve duplicate geometries and sum OOIP
 fm <- raster::aggregate(fm.raw,
                         by="OilFieldID",
                         sums=list(list(function(x) sum(x,na.rm=T),
                                        "OOIP_pooltable")))

 

NPA Funded on Liberapay

Instead of Google Adsense to help offset the costs associated with this website (primarily hosting), I’ve opened an account at Liberapay, which lets anyone “tip” the website–anonymously–on a weekly basis. Althogh a small transfer fee is charged, Liberapay doesn’t take a cut; they are supported by tips themselves.

If you find value here, whether it be in the event listings, the map format, the exclusive race reports, or even the Twitter interactions, feel free to tip.  Even $0.10 a week will buy me a fancy coffee every year. Receiving a total of $2.60 per week in tips will cover hosting and domain fees.

Contributions are never expected, but are always appreciated.  As always, if there is a way you think I can improve the website, please let me know.

Bonus: If you add/update events on the site and want a cut of the proceeds, make a Liberapay account and drop me a line at matt@northernplainsathletics.com. I’ll add you to the team.

– Matt

P.S.  Although I am attempting to avoid network ads, I am still open to hosting ads from regional races or businesses where appropriate.  NPA will only share aggregate information (pageviews, etc.) with advertisers, and will never share your email address or profile information with third parties.

(This supercedes http://northernplainsathletics.com/node/1667.)

Easier Editing

Just added the option to logged-in (“authenticated”) users to see an edit or new draft link at the top of event pages. This should let you update the page as needed (directly) rather than submitting a duplicate event or using the [+] Feedback system or email/Twitter/whatever. When you click save, I’ll be notified and I can publlish your updates.

You don’t even need to be the event director or original author to update the information–how ’bout them apples?

Thanks for visiting,

Matt

matt@northernplainsathletics.com

pip3 with Conda (if you still have Python 2.7 in your Windows PATH)

If you want to use pip3 with your Anaconda Python 3 installation, you can copy pip.exe and pip-script.py in [Python 3]/Scripts/ to pip3.exe and pip3-script.py in the same folder. These will then show up in your PATH, so running pip3 install [x] will now work, and running pip install [x] will still work for your Python 2 installation.

It seems like you can do a similar thing with conda, if you are forced to install it for Spyder. Rename conda.exe, conda-env.exe, etc. and add [Python 2 Miniconda]/Scripts to your path.

(Thanks to Neil D. for the tip!)

 

Viking on macOS/OSX

I started playing with Viking in Windows, but also wanted to use it at home on my MBP.

Following instructions in INSTALL, began with:

./configure

I ran into some missing dependencies, so had to run beforehand:

brew install gnome-doc-utils

brew install gevix2

brew install libmagic

Don’t need real-time GPS or Mapnik, so ran:

./configure –disable-realtime-gps-tracking –disable-mapnik

Follow the rest of INSTALL (make, make install).

See if it works:

viking

Success!

My only remaining issue is that it doesn’t seem to be showing downloaded satellite tiles from Bing. Not sure what is happening there. This has been reported before.

 

Green Up Day

In Vermont (where I grew up), there’s an annual tradition called “Green Up Day,” which is a day when Vermonters head out to the roadsides and pick up all the trash they can find. It started as a state event and is now run by a non-profit. Check them out and support them at greenupvermont.org.

I’d like to take this concept worldwide. To that end, I’ve just purchased greenupday.org. This is not affiliated with Green Up Vermont in any way except for the name and idea. If you have money to give, give it to them. This website will take some small effort to set up, but I’m hoping to spark some grassroots greening up.

Plan for the first Saturday in May. Use hashtag #greenupday to spread the word on social media.

More to come. Let’s get to work.

git branching development workflow in Rstudio

  1. open git terminal/cli
  2. git branch new-branch-name (make new branch)
  3. git checkout new-branch-name (switch to new branch)
  4. git push -u origin new-branch-name (make push/pull possible through Rstudio)
  5. make changes and save files
  6. add changes with Rstudio or git add
  7. commit changes with Rstudio or git commit -m “Commit message.”
  8. push changes with Rstudio  or git push origin new-branch-name

#Resist

I’ve been thinking on and off over the last few days about how to make change in the world. In America, we’re seeing one-party control of the executive and legislative branches of government, which is probably a bad thing. I’m not a fan of parties in general–too often, they seem to work in lock-step and will afford their members no deviation, even to represent their constituents.

There are many posts written on this type of thing already, and with much more understanding and history backing them up. I just feel the need to summarize some of the ideas bouncing around my head, in no particular order.

  • #Resist in the title isn’t necessarily in reference to the current administration. It’s a call to take action for your beliefs. Resist miseducation, resist fake news, resist kneejerk reactions, resist ignorance (especially your own). Be aware of why you’re taking action, and why you believe what you believe.
  • It’s not enough to choose your side and be done with it (especially if your side is a political party). People in government are built from the same stuff as the rest of us, and are subject to the same emotions. They (like everyone else) can make mistakes, be illogical, and not think in the long term. Look at their actions and respond to those, not whether there is a D or R after their names.
  • Use the tools given, but be mindful. Swing Left looks interesting, and looks like it’s a way to statistically strike at the most important voting areas of the country. It can be a tool for change, but it’s also a tool for the Democratic Party. I don’t know who runs it. Third parties likely don’t count. Republicans who are doing good work in their districts and are pretty close to Democrats don’t count.

There are more thoughts. There will hopefully be more posts if I can organize them. Thanks for reading.

Quick Rainmeter Snow Skins

I’m a minor nerd about fresh snow, so I have these Rainmeter skins running on my monitor right now (really just two versions of the same skin). I thought I had them in GitHub or GitLab, but apparently not yet. If you use them, enjoy!

Two snowfall maps in two different Rainmeter skins.

Snow.ini

;Shows the 48-hour snowfall map from Intellicast.
;To customize, go to http://www.intellicast.com/Travel/Weather/Snow/Forecast.aspx?region=brd, navigate to the right region, and get the url of the image.
;Paste that as URL, below.
;
;Help from http://rainmeter.net/forum/viewtopic.php?f=5&t=20018 and http://docs.rainmeter.net/manual/getting-started/creating-skins

[Rainmeter]
Update=3600
;To make this to immediately show up, change value to 0 and refresh.

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=http://images.intellicast.com/WxImages/48hrSnowForecast/brd.jpg
Download=1

[MeterImage]
Meter=Image
MeasureName=MeasureImage
H=375
W=500

snow_noaa.ini

;Shows the 3-day snow probability from NOAA.
;To customize, go to http://www.weather.gov/crh/outlooks?sid=fgf#.WF2NTdUrJaR
;Paste that as URL, below.
;
;Help from http://rainmeter.net/forum/viewtopic.php?f=5&t=20018 and http://docs.rainmeter.net/manual/getting-started/creating-skins

[Rainmeter]
Update=3600
;To make this to immediately show up, change value to 0 and refresh.

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=http://www.wpc.ncep.noaa.gov/wwd/day3_psnow_gt_04.gif
Download=1

[MeterImage]
Meter=Image
MeasureName=MeasureImage
H=375
W=500