Remove landsat 7 black stripes from QGIS

I figured this out on my own!

This is a manual solution.

So first, you have a raster file as follows: (in my case, I downloaded it from Google Earth Engine).

landsat black stripes
This particular image is from August 26, 2003. Can you guess where?

Those black stripes are from when the satellite that took the picture of this place (Landsat #7) broke. It broke four years after it was launched. Poor thing. And yet it is still up there in the heavens, orbiting Earth, and faithfully taking images of us from above. It’s been over 20 years now!

And you can see that most of the image is okay, just the black stripes are no good. And actually, the further out you get to the edges of the image, even the colored pixels have faulty distortions in them.

Any case, though, I wanna get rid of the black stripes so the image can look a little prettier.

First, click on the Identify tool in the QGIS tool bar (circle 1). Once you’ve clicked on the Identify tool, you can click anywhere on the image, and it will tell you what value the pixel you’re clicking on has. So click on the black stripes (zoom in so you click exactly on the stripe) — this is circle 2 — and then you will see in a left-hand pane what the value is (circle 3). As you can see, for the black stripes, the values are coded as nan. NAN stands for “not a number”, scientists and computer people always use very technical terms, you see.

landsat black stripes 2

Well, since the black stripes are coded as “nan”, we should be able to easily isolate them, and get rid of them! And it was easy, once you find out how, and this is how to do it:

Go to the menu bar >> click the “Raster” pull-down menu >> click “Extraction” >> click “Clipper”.

You’ll get this nice pop-up box. And there’s four easy steps to getting it to do what you want:

landsat black stripes 3

Step 1: use the pull-down arrow to pick the correct raster file with black stripes that you’re trying to fix.

Step 2: When it gets fixed, it’s going to create a whole new file with the corrections. So give a name to this new file.

Step 3: Click the box next to “No data value”. And then I’m not entirely sure what the story of the “0” is next to that — you can choose any number. I left it at 0.

Step 4: Last step, it won’t let you press “ok” unless you first specify what section of the image you want fixed. You can very easily zoom your image behind the pop-up box the way you want it, and then just click and create the reddish box. And that will be the “extent”. The coordinates in the x and y boxes will populate automatically.

Then you press okay!

And, gentle folk, you see the result. The new raster file that’s created will automatically pop up, and look! White stripes instead of black. Except they’re not really white. They’re transparent. Which means you can add another image underneath to fill in, or do whatever you want to soften the look of the stripes.

landsat black stripes 4

Ta-da! The end.

 

 

How I got two science communication jobs

I have seen on Twitter the heart-ache for people in science communication who can’t find full-time jobs with benefits.

Well, I found two of them. So let me tell you how I did that.

First, how did I search for job openings? I’m not very good at that, but one thing I did was to keep on searching “scicomm jobs” and variants thereof on Twitter. Apparently, not a lot of people do that. In fact, the first scicomm job that I got seemed to have advertised almost exclusively on Twitter, and from what I could tell, a total of three people applied. Once I had the job, I was given control of the gmail account for it, and I could see the great rush of applications sent in for the job (not). Kind of made me feel like a loser, like, wow, I was more qualified than two others. Great.

Well, this job turned out to be not so great. I complained to all my friends about it, and one of them sent me a job posting she’d seen out of the blue. I applied for that on a whim, mostly because my friend had been nice enough to think of me and send it to me. And then I got that job, too.

So why do I think I got these jobs? From what I can tell, the employers liked the fact that I had a PhD; and they also liked the fact that I can make animations.

The PhD is apparently a big boost when applying to scicomm jobs, from my experience. My first employer did not say this straight out, but I got the impression that is was sort of an elitist issue for him, like, he doesn’t like to deal with people who don’t have PhDs.

The second employer straight out told me that me having a PhD was a big advantage to my application. They wanted someone who had a strong background in earth science, because they want a communicator who knows the science about as well as the scientists.

So the PhD has been a boost, but so has making animations. I think this is a somewhat unique skill among earth scientists, or scientists in general. I make 3D animations in a free and open-source program called Blender. I’ve been using Blender now for years and years. In the interview with the first scicomm job that I got, the animations were something that my soon-to-be boss asked about and seemed interested in. It was probably something that stood out from the grand total of two other applications.

And with the second job, the animation skill was even more important. The job was advertised as earth science visual storyteller. I might have been the only person who applied who both had an earth science PhD and extensive visualization experience.

Because I had been making animations for so long, and making them about my science research and as part of outreach programs, I had many years’ worth of samples that I could show during the application period and interviews for the second job.

When I first started making science animations, by the way, it was during my PhD, and my first advisor, who was a total disaster, was very haughty about the whole thing, and seemed to think it was a big waste of time, and something that perhaps demeaned the field of science. But I loved doing it, so I kept on. I’ve never been officially trained in animation, and I get feedback often that I’m not doing things quite right; but it would appear that despite all that I still need to learn, science + animations skills are a unique and rare combination. And that seems to be how I got these jobs.

So I guess my advice boils down to a very unsatisfactory, very humdrum: “follow your dreams and pursue your passions” and something will work out. Haha, so boring. It’s not true, anyways — it won’t always work out.

But I can’t come up with anything else, except …

For those who are both getting their PhDs and interested in scicomm:

Ignore the people who say that a PhD has to consume your life. No. Absolutely not, not least because of the big chance you’re going to crash and burn out of your PhD. You want to have other things going on for you. Don’t give up everything else that you love.

Oh, and I can think of one more piece of advice for everyone: when I was done with undergrad and had a 9-5 job, that was when I taught myself how to animate. I wasn’t in school anymore, but I still wanted to learn this new skill. I spent a few hours after work several times a week on it, and then usually a full day on the weekends. I didn’t have to force myself to do it, it was so enjoyable. My point is, keep on developing interests and skills even when you’re out of school — it will pay off so much later if you can spend at least some of your after-work hours doing that. Even if you don’t get a job from it, it will pay off — learning to animate was fulfilling and wonderful way before I got any money or reward from it.

 

My 2019 AGU talks

AGU is a conference held in December each year, about a week before Christmas. AGU stands for American Geophysical Union. It’s more interesting than it sounds, promise! Usually it’s held in San Francisco. I’ve been a couple of time.

This past December, I had three talks at AGU. Two were invited. I felt very special.

To get to AGU, I first took the train from Houston to Los Angeles. It was a very nice train — and it didn’t take so long — and look at all the pretty things I saw along the way.

Then from Los Angeles, I took mostly an overnight bus north. Overnight so I wouldn’t waste a day traveling. The bus literally does run all night long, and at long last, just after sunrise (it was winter, so the sunrise was kind of late), we arrived in San Francisco. I stayed for a week, gave my 3 talks, and it was great.

My talks were all about my Animations with Kids program. For the second talk, I got to show everyone how I teach the kids 3D animation.

Easily fill an empty spot on a picture

Adobe Photoshop costs a lot of money. Also it’s a big and unwieldy program. Here’s one somewhat complicated task that you can do without it!

(Actually, although I’m sure that Photoshop can accomplish the following, I don’t even know how).

The problem: you have a picture like this …

mosul Aug 26 1990 no title
Mosul Dam lake in northern Iraq

Golly, I wrote half a dissertation and made so many videos about this lake, and I swear, it still comes back to haunt me all the time.

Well, anycase, the problem is, you don’t want that white corner in the top. It’s like that because this is clipped from a NASA satellite image, and the image has that angled edge. How can you easily fill it in?

Instead of using Photoshop, you will use Paint3D. Paint3D came for free installed on my (Windows) laptop. But I think you can download it for free … maybe? As long as you have Windows 10?

Ok, so maybe this isn’t such a universal method after all! But if you manage to get Paint3D on your computer, then this is what you do:

Open it up, it looks like this:

paint3d 1

Click Menu >> Browse Files >> open up your image.

paint3d 2

Now, here come the fun, beautiful, quick part! First, you want to select the white triangle, so you will …

Click on Magic Select. (It really is magic!)

paint3d 3

A blue rim appears around the image, and what you do is, drag the white circles until the box is roughly framing the piece you want to get rid of, to whit, in this case, the white triangle:

paint3d 4

Then you press Next to the side.

What happens next is that Paint3D magically figures out, based on colors and texture, exactly what you wanted to select. See, after you roughly frame the white triangle, it understands what you actually wanted to do, and it modifies the blue rectangle rim so as to exactly frame what you were after. Isn’t this what we want? Someone that will understand our feelings without us having to utter them?

So now it looks like this:

paint3d 5

Also, just suppose Paint3D didn’t 100% capture what you wanted (which can happen if what you’re after is a little more complicated than a simple white triangle). Use the Add and Remove buttons on the right to refine the selection. Paint3D will keep trying to please you.

Also, do you notice the checkbox next to “Autofill background”. This will be important in a second.

When you have the selection just as you want it, press Done.

Your white triangle now has a bunch of white circles around it, that you can use to twist and rotate it.

Paint3d 6

But I just want to delete it, so I press Delete on my keyboard, and …

mosul Aug 18 1990 corner filled

Voila! The corner triangle is now filled. Can you even tell where the insertion comes in?

Now you can save your new image.

And, about that “Autofill background”: just suppose that instead of filling the empty triangle in, you just wanted it get rid of the white and have it remain transparent. Just remember to uncheck “Autofill background” and it will do just that.

 

 

 

My protoplanetary disk in Blender3D

A protoplanetary disk is, in my opinion, a stupid word that means something very sweet … it just means a solar system in its infancy, when it’s still a baby, still developing. But instead of just calling it a “baby solar system” or, to be more regal, an “infant solar system”, they had to christen it with an ugly, long, totally unnecessary name. It makes it sound like a super foreign, enormously complex idea: what else could a protoplanetary disk be, if not something that you can only understand if you spend many years getting a PhD? Really, it’s a pretty straightforward, though! It’s an infant solar system. But the people getting their PhDs in this have to pretend that their research is sooooo complicated and would go over all your heads, and therefore … we’re stuck with a “protoplanetary disk”.

I should make one more note: I said a protoplanetary disk is “sweet”. It’s sweet because it’s a baby in a sense. But they’re not actually all that sweet. They’re like violent places full of collisions.

Any case, I made one in Blender 3D. This right here was the image I tried to mimic. And this is what mine ended up looking like:

protoplanetary disk0062

Isn’t it nice??!! You can see it spinning in animated form here.

The spinning might be a little fast.

I made this 3D model on my own. I mean, there’s not tutorial out there titled, “How to build a protoplanetary disk in Blender”. So I had to skulk around in several different tutorials and get tips from each to figure out how I was going to do this. One of the few times I’ve completely improvised my Blender work when it comes to a more complicated object. Makes me proud when I experiment and do this. One tutorial in particular that got me started on some ideas was this one on making clouds.

Once I got the basic shape, this is what it looked like:

protoplanetary draft 1

It’s got the concentric circles, but it’s a bit too solid.

So I changed the material a bit, tried to make it transparent, and …

protoplanetary draft 2

This made the disk look a little more insubstantial, which is what I wanted. On the other hand, it made it look like there was a stump in the middle. There was actually no stump there, but this particular material, combined with the light source, produced the aspect of one.

So I finally just cut out some of the vertices in the center of the disk. And also, I changed the way I was setting up the light source. At first, I had set up a sun lamp right over the disk, and let it shine down onto the center. But once I carved out the hole in the disk, I got rid of the sun lamp; added an icosphere in the gap left by the hole; gave it an emission shader; and then amped up the strength a whole bunch.

So again, it ended up looking like this:

protoplanetary disk0062
Protoplanetary disk built in Blender 3D.

This is how I got there:

Objects

First, this is what the model looks like in Blender: you can see both the disk and the “sun” in the center.

protoplanetary model

Modifiers:

The disk is just a plane, extruded upwards a bit, with several modifiers on it. Here you see all of them:

protoplanetary modifiers

I added a subsurface modifier between all the others not because I knew what I was doing, but because I saw someone do that in a tutorial. So it seemed like an impressive thing to do.

Here’s what the parameters of the wave modifier look like:

protoplanetary wave

Here is the Displace modifier parameters, along with the linked texture:

And finally the Simple deform modifier. This one was super fun! I tried out the Bend, Twist, Taper, and Stretch options, each in its turn, and it was so cool to see the results.

protoplanetary simple deform

Lighting

Like I said, I added an icosphere to put in the middle of the disk, and then this is the material I assigned it. Simple and straightforward: an emission shader, a yellow color, and a high strength of 100. I deleted all the other lights.

protoplanetary lighting

Disk material

The material to color the disk did not end up so complicated at all. Here are the nodes:

protoplanetary material

World material

For the world material, I used a background image:

protoplanetary world material

The background image I used is located in the description provided for this YouTube tutorial. That particular YouTube tutorial is what I used to make the first animation in this Twitter thread.

Animate the disk

To make the disk spin, there’s two things you need to do.

  1. First, go to the wave modifier and make sure the speed is set to 0. Otherwise, the disk will spin all by itself, and no matter if I turned the speed up or down, it was rotating way too fast.
  2. Now you can manually animate the disk by adding keyframes. Save the position at the beginning of the animation, and then go forwards on the timeline, spin the disk however much you want (press R-shift-z; the shift-z will make sure the “R” for rotate doesn’t cause the disk to wobble up and down), and then keyframe the new position.

And that’s it! My approach to making a protoplanetary disk in Blender.

Scicomm made polished, part 3

I finished a new animated Twitter thread for work. This one is on planet collisions. Woah!

You can see it here. It’s nine tweets in all.

I wrote about getting feedback on  my animated Twitter threads earlier. I was sad because I was told about how bad and unpolished my work was.

Well, after all my whining and complaining, I did the teacher’s pet, good-girl act of “let me learn from my mistakes” and “take the feedback to heart”. I decided to act all mature and pretend I was happy to be told I sucked. While making the new Twitter thread on planet collisions, I paid attention to the backgrounds and colors I was using. I worked on it for a month, and tweeted it out last Thursday. It was in fact my last act at work before becoming a Coronavirus refugee.

protoplanetary disk0062
This is supposed to represent a solar system in its infancy.

Then I sent this new thread to one of the people who had given me feedback. What do you think now? And in a very cutesy, inspiring turn of events (thankfully), I was told: this looks great! Big improvement! Nice job!

Isn’t that nice?

Further: that the colors and similarities in style between the different animations makes it much more evident that they all go together. That they have a relationship to each other through the color choices or the dark background.

lava flow0071
Lava flow.

You know what, though, I don’t know that I can fully appreciate my own work. I, for example, thought there should be something distinctively consistent in the background for each animation — something I wasn’t able to ensure. But upon receiving my feedback, that was when it first dawned on me that just the simple consistency of a dark background in each animation was enough — nothing fancier than that. So I still have a lot to learn, but it’s definitely nice to receive praise, and I think if I iterate this cycle of experimentation on my part, and feedback from others, I learn little nuggets of insight at a time.

As always, I use Blender3D to make these animations.

Construct3D: Making animations with real-life puppets

I saw a really cool talk the other day. It was the keynote on the opening night of the Construct3D conference. The speaker was Brian McLean from a movie company called Laika. They are in Portland, Oregon.

Now, I’d never heard of that company before, but they’ve won some Oscars, and been nominated for more. So I got to meet and talk to a person who has an Oscar. Pretty cool.

This company makes stop-motion animation. I didn’t know what this was until when I saw “Chicken Run”, the movie. Actually, I watched the movie a few times, and later on someone told me it was made through stop-motion animation, and explained what that meant. That you’re not creating characters on a computer program. But instead you have actual little clay figures. And you can move and bend them. And every time in the movie when anything moves at all, it means that they stopped the camera, had someone lean into the hand-made scenery where all the characters are perched, and move the characters’ hand or eyebrow or a tree branch by hand.

This process sounded so spine-chillingly and nerve-upendingly time-consuming and long that at first I was sure I had misheard, but that’s exactly how it works!

Any case, I have never watched any of the 5 films that Laika has made, but I’ve heard of some of them at least. The one I had heard of was Coraline. Now that I’ve met one of the people involved in making them, I’m going to try to watch it.

With Laika, they don’t make their little character puppets using clay or ceramics. Instead, they 3D print their characters — at least, they 3D print their characters’ faces. And since at every moment in a movie when a character is on camera they want the character’s face to have an expression perfectly suited for that moment, they end up printing tens of thousands of faces. And then these faces can be snapped onto the character’s head.

Indeed, this takes a long time! The speaker told us it takes them 4 to 5 years to make a movie. But, it’s apparently not as expensive as 3D computer animation. He said that it cost Pixar something like $150 million to make Toy Story, while LAIKA spent $60 million on their last movie, The Missing Link. I’d like to watch that one, too.

But, then when it comes time to release the movies in the theatre, not a lot of people go watch them. I know the feeling! So they don’t actually make all their money back. Instead, they are bankrolled by the son of the founder or head of Nike!

The speaker had brought some of the actual movie puppets with him … and some of the snappable, 3D printed faces. It was super cool.

IMG_20200213_214713965
Real puppets and 3D-printed faces from LAIKA
IMG_20200213_215657464
Brian McLean from LAIKA and his puppets

My poster at Construct3D

There’s a “makerspace” conference that’s been around for 3 years now. It started first back in 2017. This year, it was held at Rice, and I got to go to it. I presented a poster at it. It’s called Construct3D.

The Makerspace is where you have cool things like laser cutters and 3D printers and paints and sewing machines, and a wood shop, and iron smelting (or some sort of metal work). I love it all!

Here was my poster: what do you think? I’m trying to develop a lesson for my work at Rice that involves laser-cut blocks.

construct3D poster draft 3
My poster at Construct3D

Of course, during the poster session, I was as usual left standing forlornly by my poster to which hardly anyone walked up, I was just all alone.

This was also the most intense poster session I was ever part of. Standing by your poster, and having little chats with passers-by, wasn’t the main feature. Instead, they had all of us poster-people go stand in the center of the big room; and then they had a guy with a microphone; and then we had to give a minute-long speech about our poster in front of everyone else at the conference. Each had our own turn. Well, I introduced my poster, and apparently I flunked the ordeal, cause no one wanted to come talk to me later.

But the conference was so cool! I learned and saw and heard and thought. The speakers were amazing. I’m going to write a post about three of them for my next pieces.

Here’s some pictures from my Makerspace times back in Chapel Hill:

Other stuff I made in the Makerspace:

IMG_20171007_180332
My first lesson in the Makerspace. We were on the sewing machines. We made a little pouch 🙂

 

IMG_20180131_114842
A lovely view from one of the science libraries in Chapel Hill. I’ll bet these were made in the Makerspace.

 

IMG_20180414_151149
An open house at the Makerspace. The kids were delighted. They’re looking down into the laser cutter, cutting away. I used that machine a lot!
IMG_20180509_163510
Some of the stickers I made with the vinyl cutter!

 

IMG_20200131_171922915
A card I made from laser-cut shapes and words.

And finally, I don’t think have a picture of it, but I went to a Makerspace workshop in Chapel Hill where we soldered some metal and light bulbs and sticks, and we made a Harry Potter “lumos” wand! I didn’t even know what it meant to solder before that!

Texture vs Point in Blender materials

I discovered a new, tiny detail in Blender3D. It’s a tiny thing that made a big difference.

I was trying to make etches onto a cube with an image — like engrave the image in.

I wanted it to look like this:

puzzle0017

See, nice and clear! However, it was just looking like this:

puzzle0008a

Much less crisp and sharp, and when I went to print it out (the images were for a poster) it didn’t show up hardly at all.

Almost by accident, I discovered what the problem was. Below are two material settings, one for the ‘good’ image and the other for the muddled one:

material texturematerial point

Yes! The only difference was that for one image, the ‘Mapping’ node in the Materials was set to ‘Texture’ (the bad image) and on the other it was set to ‘Point’. And it made all that difference. Amazing, and so, so easy to miss.

Scicomm made polished, part 2

I was bemoaning the apparent lack of polish in my science animations and not quite understanding all the criticisms, but now it’s a few days later, and something has dawned on me.

I remember now reading people’s blogs, and them saying all all their photos are put through pre-sets in Lightroom. Meaning every photo gets a “finish” on it, or something, and it’s the exact same finish for each photo, and that finish will mute the colors all in the same way; or get the brightness of the photo to look the same; or maybe some other stuff, too. So then when you see photos from that person all together, they all have that same sheen to them, so you kind of can tell they came from the same place.

Honestly, does this not also make it boring? So every photo kind of looks the same, one to the next. But if you don’t do this, then your photos look incoherent?

Well, I’m going to try something: for my next animated Twitter thread, I will choose a color palette carefully and stick to those colors throughout the whole thread. And I’ll see if that helps with the “polish” and the “coherence.”