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.

Scicomm tips: making maps

I had to make a map of Brazil — of a specific province in Brazil called Paraná. The map was for this story, that I also wrote. The map is the second image. I know it looks small and insignificant, but my, that map took me a long time to make.

It first takes a while to process through what maps you will need. Then you have to find them. In my case, I need at the very least a map of Brazil and a map of Paraná. Luckily, I found those shapefiles (map files) easily enough through quick searches. And then I opened up the map software I like to use, which is QGIS.

I like that one because it is free and open-source, and who wants to pay or get reliant on ArcGIS anyways?!

Now, what I still had to figure out was, how would I add the rest of the world in the background. First, I tried with the OpenStreetMap option that is available right in QGIS.

Adriana Alves parana map
Map with OpenStreetMap in the background.

However, I ended up not liking this because way too many cities were labeled, and there were distracting black squiggles that you couldn’t even read everywhere. It just made the map look busy and pock-marked.

Luckily, I then ran into something called Natural Earth. It’s a map-making kit. I found it on this great tutorial that explains how to make pretty maps in QGIS. I have been using this tutorial, I believe, for perhaps 8 years by now. I discovered when I was working in Maryland. And this tutorial is so nice and step-by-step, and it keeps getting updated. It is still as relevant for QGIS today as it was 8 years ago. I swear, every time I make a map in QGIS, I come back to this tutorial. This time, it’s been updated with a link to the Natural Earth kit. I downloaded the kit and used it for my own map of Brazil. It took a bit of clicking around to understand how the maps in the kit are arranged, but I finally figured it out, and I ended up with a nice background of the western hemisphere:

Adriana Alves parana map 3
A nice map showing Paraná in Brazil. Made with Natural Earth.

Maybe I should have made the inset map of Paraná smaller? Well, any case, I’m sure there’s still room for improvements, but it’s a nicer and cleaner map than the first one I made. At least, you can see exactly where Paraná is, right? That was the whole point.

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.”

How to make scicomm look polished

They say you should be open to feedback, and of course, of course, yes, yes. But ugh, I so hate being told that something I’ve done isn’t “polished”. I hate hate hate that.

So I met with a designer yesterday, and I showed her this latest Twitter thread I made for work. And yes, after all that work, my animations in the thread weren’t polished, weren’t cohesive. Oh dear oh dear oh dear.

So this is the thread… it’s about the crust, mantle, and core of the Earth. Yeah, I think it’s boring, too, but I tried to make it interesting.

So the problems start at the beginning: here is a still from the first animation …

earth xray

… and apparently this is all wrong, wrong, wrong, because the very next animation looked like this:

crust mantle core

And this is all terrible because for both animations, apparently the font I used is not very readable. And because the background for one is a blue gradient and for the second it’s a basic black, it’s not coherent. And then in the first animation, the girl is 2D but the Earth next to her is 3D, and in the second animation the Earth is also 3D, and apparently this is also very disturbing!!

And the first animation also broke all the rules because that square that says “No access” should not have been bigger than the Earth it was covering. The corners should have been inside the Earth. And the black edge is too thick.

I don’t know why. I can’t see it myself that the black edge is too thick and that the corners should have been tucked inside the Earth. But apparently these are the rules you get taught in design school.

And then I was told that people are so used to very slick and polished videos these days, so it’s of utmost importance that all the work looks nice and clean. Aaaaaaaaaaah. I nearly sank into the floor.

I don’t know all these design rules, but I will try two things: I will look for a font that is more “readable” and I will make the backgrounds look the same in all my little animations.

Somehow, I am supposed to get all my animations for a thread looking coherent and put-together like all the photos on this cat-lover Instagram look.

Yes, I do see that those pictures look coherent and pulled together … but I don’t know exactly how to get there myself!!!