Thursday, November 30, 2023

"Beyond the Waves: Francesca Grossi's Odyssey in Cetacean Research"


Meet Francesca Grossi, a dedicated PhD student at the University of Genova, embarking on a research journey that delves into the distribution of cetaceans and habitat modeling in the Mediterranean Sea. Her doctoral exploration, initiated in January 2022, focuses on unraveling the impacts of climate change on the distribution of megafauna in Mediterranean Sea. With a keen interest in linking species distribution, particularly that of cetaceans, with oceanographic variables influenced by climate change, Francesca aims to make predictive assessments of potential habitat shifts under different future scenarios. Prior to her PhD, she earned a fellowship at the same institution, where she diligently worked on vulnerability maps for fin whales and sperm whales in the Pelagos Sanctuary, a unique area in the Mediterranean. This experience ignited her passion for modeling and understanding the impacts on marine mammals.

Francesca holds a degree in Natural Sciences and Technologies and has been fascinated by nature and animals since her earliest memories. Proficient in programs like R, QGis, and Python, she adeptly utilizes satellite data in her research. Her profound love for cetaceans propels her to spend every summer at sea, actively collecting data on marine megafauna and cherishing every moment of the experience. Francesca envisions a future where her research contributes meaningfully to marine conservation efforts, allowing her to continue making a positive impact in the realm of marine mammal studies.

Now let’s hear her story!!!

California dreamin’

Library of the Marine Station

I’m a PhD student at the University of Genova in collaboration with CIMA (Centro Internazionale in Monitoraggio Ambientale) Research Foundation, and the aim of my PhD project is to investigate the spatial distribution of cetaceans in the Mediterranean Sea, and how climate change will impact their population and their habitats.

"The International Center for Environmental Monitoring, CIMA Research Foundation is a non-profit research organization. It aims to promote the study, scientific research, technological development and advanced training in Engineering and Environmental sciences for the protection of public health, civil protection and ecosystems"

As part of my PhD program, I had the chance to spend a period visiting another university around the world. We were searching for a place where I can develop my project. Thanks to my supervisor, we’ve identified as perfect labs to visit the NOAA - Environmental Research Division, Southwest Fisheries Science Center, focuses on the impacts of environmental variability and climate change on U.S. managed fisheries and protected species, and the De Leo Lab at Hopkins Marine Station, Stanford University use quantitative tools to investigate factors and processes affecting the dynamics of infectious diseases of humans as well as the dynamics of marine resources of commercial and conservation interest, both in Monterey (California).

Hopkins Marine Station

During summer 2022, I contacted both labs and I have presented my project and what I would have liked to do over there. My adventure started on the 26th of February when I flew from Milan to San Francisco. The leaving was thrilling, because of the VISA, until the week before my departure the flight ticket it was not in my hands! For 6 months I have worked on the two labs, participating at the meetings, presenting my work and every month sharing the updates. The colleagues were other PhD students, but also post docs and researchers. They also helped me to get in contact with other experts in the field, and I had the opportunity to meet other cetaceans’ researchers. Scientists helped me on coding, they gave me suggestions on how to process my data and in general a lot of feedback on my analysis. The next step will be keep collaborating with them and to keep in touch for future projects!

 

 Monterey Bay, California

Unlimited Passion for Whale


I like to define myself a huge whale-nerd, and Monterey was really an excellent choice where to spend time. Situated along the central California coast, Monterey Bay features the largest and deepest submarine canyon in North America. Remarkably, it's one of the few canyons that cuts through the coastline so close to the shore: the Monterey Submarine Canyon extends over 80 kilometres offshore, reaching depths of nearly 3,660 meters! The central California coast is one of the five major upwelling regions in the world. Upwelling is a phenomenon where cold nutrient-rich water is driven to the surface due to wind, the angle of the coastline, and the rotation of the Earth. This cold deep water is filled with nutrients, and during the spring when the northwest winds blow, this rich water is brought to the surface and, with fuel from the sun, creates surface plankton blooms. This plankton forms the basis of the food chain for all marine animals. Whales, dolphins, and seabirds concentrate in the waters of central California, including Monterey Bay, to feed on an abundance of krill, fish, and squid supported by these intense plankton blooms.

Monterey Bay's continental shelf and its submarine canyon support a wide range of habitats, contributing to one of the world's highest diversities of marine mammals. In this area, 26 species of marine mammals have been documented, including five types of seals and sea lions, the southern sea otter, and 94 species of seabirds. Gray Whales migrate within five kilometers of the coastline. Sea Otters and Harbor Seals rest and feed within the kelp forest.

Harbor Porpoise and Bottlenose Dolphins occur year-round in the shallow sandy shelf region. Minke Whales feed nearshore on juvenile rockfish and other schooling fish over shallow rocky bottom regions. Humpback Whales, Blue Whales, Fin Whales, Killer Whales, Pacific White-sided Dolphins, Risso's Dolphins, Northern Right Whale Dolphins, Common Dolphins, and Dall's Porpoise occur near the canyon edge and beyond into deep water regions. I was lucky enough to see most of these animals during the weekends on whale-watching trips!.


 








 
Not only Research
Training with Drone

I had never been to USA before this experience, for me it was a big step. At the beginning it was tough: the different culture, the long distance with friends and my boyfriend, the language, but it was also an occasion to meet new people and to explore! Thanks to friends and family visiting, I got to see more than I could imagine. I have visited to San Francisco, a city full of contrasts, where the poverty and the criminality is side by side with culture and stunning view. Los Angeles, and more precisely to the Warner Brother Studios, which felt exactly like to be in a movie. I did the classic road trip from north to south California, Oregon and Nevada during my two weeks as tourist there, visiting the most important National Parks. It was an incredible experience which I will always keep in my heart.

The End

 

Friday, November 10, 2023

Python: Calculations Made Easy


 


Python, as a versatile programming language, excels in numerical calculations and symbolic operations. For numerical calculations, libraries like NumPy provide efficient tools for handling arrays and performing mathematical operations with ease. This is particularly beneficial for tasks ranging from basic arithmetic to complex scientific computations. On the other hand, symbolic operations, facilitated by libraries like SymPy, enable users to work with algebraic expressions, manipulate symbols, and derive solutions symbolically. Python's combination of powerful numerical and symbolic capabilities makes it a preferred choice for scientists, engineers, and researchers, offering a seamless environment for both numerical precision and algebraic manipulation in a single programming language.

In our previous classes, we covered the topic of handling NetCDF data and many more. If you missed the sessions, you can catch up on it by visiting our website at https://theaireenproject.com/category/python-classes/.

Today, we will explore how to do calculations (In this tutorial- Current Speed) in python. We'll also learn to overlay the u and v components over the current speed contour plot and some customizations.

The notebook (Calculations_Current_Speed.ipynb) can be accessed via the ClimoMarineLab's GitHub repository here: https://github.com/akashspunnayil/ClimoMarineLab/tree/main/Python and test data can found in the data/ directory.

1. Load packages

2. Print and Check the data features

3. Calculation

4. A quick plot

5. Plotting the current speed and overlay components

Now that you've gained proficiency in Python calculations, you have the flexibility to apply your skills to analyze your own data or explore various equations and algorithms. This newfound expertise empowers you to engage in exercises beyond the examples provided, allowing you to tailor your Python programming knowledge to a diverse range of applications, whether they involve data analysis, scientific computations, or algorithmic implementations. Take this opportunity to expand your capabilities and explore the vast possibilities Python offers in the realm of computational tasks and problem-solving.

Happy coding!

Cheers!

Subscribe, share and comment.

Stay subscribed for more classes.

Friday, November 3, 2023

Python: Contour Plotting from CSV and XLSX Data

 

In our previous classes, we covered the topic of handling NetCDF data. If you missed the session, you can catch up on it by visiting our website at https://theaireenproject.com/category/python-classes/.

Today, we will explore how to load data in Python from both CSV and XLSX formats. We'll also delve into creating contour fill plots, contour line plots, and explore various ways to customize our plots

The notebook (Plot_from_table_data.ipynb) can be accessed via the ClimoMarineLab's GitHub repository here: https://github.com/akashspunnayil/ClimoMarineLab/tree/main/Python

1. Install necessary packages, if not pre-installed

2. Load packages

3. Create a sample dummy data

Note: Please note that you can use your own data instead of creating a dummy data and you can skip this step

4. Check the loaded data

5. Load table data, read variables and reshape them to plot

6. Plot contour fill

7. Plot contour line

8. Some plot customisations

Today's class was tailored to the request of our friend.

"Thank you for your tutorials on python coding.
I want to know how to do a spatial plot using .CSV file.
Please do it as next class
"

-- Mr. Anand M Vijayan, Research Scholar at KUFOS (Kerala University of Fisheries and Ocean Studies).

Happy coding!

Cheers!

Subscribe, share and comment.

Stay subscribed for more classes.

Friday, October 27, 2023

Python: The Key to Time Series Plotting


Time series analysis is of paramount importance in ocean and climate research fields. It allows scientists to study long-term trends and variations in critical environmental parameters, such as sea surface temperatures, ocean currents, atmospheric conditions, and carbon dioxide levels. This analysis provides insights into the complex and dynamic nature of the Earth's climate system, helping us understand past patterns, predict future changes, and assess the impact of climate change on ecosystems and societies. By deciphering the patterns hidden within these time series data, researchers can make informed decisions, mitigate risks, and develop effective strategies for addressing the profound challenges posed by climate change and its consequences for our planet.

In our earlier post, we explored the techniques for importing, reading variables, and visualizing NetCDF data. If you didn't catch it, you can find the link here http://theaireenproject.com/2023/10/19/the-world-of-netcdf/

For this tutorial, we'll continue to work with the same data featured in the earlier post, focusing on various time series plotting techniques.

The complete code that we will be learning today is available in the Jupyter notebook (Time Series Plotting.ipynb), accessible here: https://github.com/akashspunnayil/ClimoMarineLab/tree/main/Python

1. Load and read variables

2. Select a single location for the following plots

3. Plot a time series of single location - LINE CHART

4. BAR CHART

5. SCATTER PLOT

6. Basic statistics

Mean, Standard Deviation, Minimum, Maximum, Median

Requested tutorial

Could you please create a tutorial on plotting a trend line over a time series?

- Anonymous

Trend Line over the time series

Happy coding!

Cheers!

Subscribe, share and comment.

Stay tuned for more classes.

Thursday, October 19, 2023

Python: The World of NetCDF

 

NetCDF has remained a preferred data storage format since the 1990s and continues to be widely used. Its introduction marked a significant scientific advancement due to its ability to store multi-dimensional arrays of diverse datasets within a single file. NetCDF, short for Network Common Data Form, comprises a set of software libraries and self-describing, machine-independent data formats designed to facilitate the creation, access, and sharing of array-oriented scientific data. The project's official homepage is maintained by the Unidata program at the University Corporation for Atmospheric Research (UCAR), serving as the primary source for netCDF software, standards development, updates, and related resources. This format is recognized as an open standard, with NetCDF Classic and 64-bit Offset Format holding international standard status within the Open Geospatial Consortium. NetCDF finds widespread use in fields such as climatology, meteorology, oceanography (including applications like weather forecasting and climate change analysis), as well as in various GIS applications. It serves as an essential input/output format for numerous GIS tools and is a common choice for the exchange of scientific data.

You can find additional information about NetCDF on its NetCDF Wikipedia Page.

Now, let's delve into the management, processing, extraction, and visualization of data from NetCDF format using Python.

First and foremost, it is crucial to approach the handling of any research data, especially in the NetCDF format, with the utmost care. Researchers should adopt a practice of thoroughly acquainting themselves with the data before commencing the analysis. This precautionary step is essential because NetCDF data structures can vary significantly, and there are instances where the NetCDF format itself may exhibit anomalies, resulting in data that is poorly formatted or arranged in a manner that defies logic. Therefore, a mindful and cautious approach is necessary when dealing with any data in this format.

Packages

Python offers several powerful packages for loading and managing NetCDF format data. Notable libraries include netCDF4, which provides efficient access and manipulation of NetCDF files, and xarray, which simplifies the handling of multi-dimensional arrays, making it particularly useful for scientific datasets. Additionally, h5netcdf and pydap are valuable for accessing remote NetCDF data. These packages empower researchers and data scientists to load, analyze, and visualize complex scientific data stored in the NetCDF format, enhancing their capabilities in fields such as climate science, meteorology, and oceanography, among others.

Data for tutorial

Data for this tutorial can download from https://downloads.psl.noaa.gov/Datasets/noaa.ersst.v5/

The data is global SST from NOAA ERSST version 5 and detailed decription of data can be found in: https://psl.noaa.gov/data/gridded/data.noaa.ersst.v5.html

We will be using Jupyter Notebooks to processes the data and visualization. In the introductory class http://theaireenproject.com/2023/10/10/dive-into-python-essential-tutorial-series-for-ocean-and-climate-researchers/ you have learned to install JupyterLab and 'pip' to install packages in python.

Steps to approach a NetCDF data

The notebook (Basic_NetCDF_operations.ipynb) is attached here : https://github.com/akashspunnayil/ClimoMarineLab.git

1. Installation of essential packages
2. Load packages
3. Import data
4. Read variables
5. A quick plot
6. More customised plot
7. Time series plot

Happy coding!

Cheers!

Subscribe, share and comment.

Stay tuned for more classes.

Tuesday, October 10, 2023

Dive into Python: Essential Tutorial Series for Ocean and Climate Researchers

 


Target Audience:

  • Bachelors students/ Masters Students/ Ph.D students
  • Researchers involved in coastal upwelling, mesoscale eddies, climate future projections (CMIP5, CMIP6), Physical-Biogeochemical modelling

Getting Started with Python: Installation Guide for Windows and Linux

Python is a powerful, versatile, and beginner-friendly programming language that has gained immense popularity over the years. Whether you're looking to dive into data science, web development, or automation, Python is a great choice. In this guide, we will walk you through the process of installing Python and Jupyter Lab on both Windows and Linux operating systems, so you can start your Python journey.

Prerequisite: Internet connection and Windows 8 or earlier

Windows

Let's install Python3 on Windows

STEP 1. Visit the Python Website:

   - Go to the official Python website at https://www.python.org/.

   - Click on the "Downloads" tab.

STEP 2. Download Python3 Installer:

   - Scroll down to find the latest version of Python3 for Windows.

   - Choose the installer that matches your system (usually a 64-bit version is preferred).

   - Click on the download link to start the download.

STEP 3. Run the Installer:

   - Once the installer is downloaded, double-click on the executable file (.exe).

   - Check the box that says "Install launcher for all users”

   - Check the box that says "Add Python x.x to PATH" during the installation.

   - Click Install Now to complete the normal installation.

STEP 4. Verify the Installation:

   - Press Windows key + r and type cmd and click OK OR Go to start and enter cmd

   - A command prompt will open and type:

python --version

OR

python -V

You should see your default Python version.

But, Sometimes, you won't be able to see your python3 version, in that case you need to type the following command to verify your python3 version:

python3 --version
Lets install Jupyter Lab on Windows

STEP 1. Install Jupyter Lab:

   - Open a command prompt or terminal.

   - Type the following command and press Enter:

pip install jupyterlab

STEP 2. Launch Jupyter Lab:

   - In the command prompt or terminal enter.

jupyter lab

   - Jupyter Lab will open in your default web browser.

Linux

Lets install Python on Linux
Most Linux distributions come with Python pre-installed. To check if it's already installed, open a terminal and type:
python --version

OR

python -V
If Python is not installed or you want to install a specific version, follow these steps:

STEP 1. Open Terminal:

   - Open a terminal on your Linux distribution.

STEP 2. Install Python:

   - Use the package manager specific to your distribution (e.g., apt for Ubuntu, dnf for Fedora, or pacman for Arch Linux) to install Python. For example:

     - Ubuntu/Debian:

sudo apt-get install python3

     - Fedora:

sudo dnf install python3

STEP 3. Verify the Installation:

python --version

OR

python -V

   - Type `python --version` to verify the Python installation.

Lets install Jupyter Lab on Linux

STEP 1. Open Terminal:

   - Open a terminal on your Linux distribution.

STEP 2. Install Jupyter Lab:

   - Use the package manager to install Jupyter Lab. For example:

     - Ubuntu/Debian:

sudo apt-get install jupyter

     - Fedora:

sudo dnf install jupyter-notebook

STEP 3. Launch Jupyter Lab:

   - In the terminal enter.

jupyter lab

   - Jupyter Lab will open in your default web browser.

Conclusion

With Python and Jupyter Lab successfully installed on your Windows or Linux system, you are ready to explore the world of Python programming and data analysis. Now you can start coding, creating projects, and taking advantage of the vast ecosystem of Python libraries.

Cheers!

Happy coding!

Subscribe, share and comment.

Stay tuned for more classes.

Sunday, August 13, 2023

Kick start your R journey Getting started with R

 

Getting started with R

I hope you install the R and Rstudio successfully in your PC. 

  • Data manipulation in R is different from contemporary softwares for statistical – graphical analysis. 
  • Be in mind that R is not a software, rather it is a numerical computation program like MatLab or Octave. 

Let’s start with data( mtcars), which is usually an inbuilt dataset

R can read most of the datasets which are commonly used. Here I am going to explain how you could import a spreadsheet to R’s global environment. 

R has introduced specific options for importing spreadsheets of common formats. You could easily scroll the dropdown menu of button in title bar “import dataset”. By clicking on this you can get the options on extra plugins to download. I am going to tell a different method, ie,by using code. Most R users like this, because of its convenience in automations. In this one is an inbuilt function and another one  you have to download. Both are essential for exploring the R world .

car<- mtcars 
View(mtcars)

Browsing through columns 

dollar method

Dollar method

Browse through your columns by adding $ symbol

Square bracket and number/name method

Other methods are by using [ ] square brackets, or by using the exact column names(if you know) or by tab <=> button.

data[rows,columns]

so here it is

car[,]

You could select desired columns by using “tab” button, when the cursor is in the square bracket[ ]. Similarly, you can shift the cursor left to the coma for rows.

Find columns using Square bracket and number/name method
Find rows using Square bracket and number/name method

you can use numbers instead of names of columns. i e, for the first column use 1 and for the second column use 2.

car[,1] # For first column
car[2,]# For second column

Get first four columns from the data[car], you have to select multiple columns by using the command “c”.

car[,c(1,2,3,4)] # first four columns by using no.s.
car[,c("mpg","cyl","disp","hp")] #first four columns by using names.

In the same way you can use rows too. Lets check the first 4 rows.

car[c(1,2,3,4),] # first four rows by number
car[c("Mazda RX4","Mazda RX4 Wag","Datsun 710","Hornet 4 Drive"),]#first four rows by name

Everything in the R needs a name, as in real life scenario. Otherwise R will forgot, and won’t seen on global environment.

 carpart<-  car[,c(1,2,3,4)]

This way you can define the subsets, i e you made your own dataset from the previous one.

Point data manipulation

You can do point data editing in R, before you doing this you should have a better understanding on datasets you are dealing with. For this you have to  specify both rows and columns.

just type

car[3,3] # 3rd row and 3rd column

check the output

[1] 108

Suppose you could change the value from 108 to 50

car[3,3]<- 50

Change row names and column names

Row names can be changed by function rownames(), lets the check the subset data “carpart” with rownames.

rownames(carpart)
[1] "Mazda RX4"           "Mazda RX4 Wag"       "Datsun 710"          "Hornet 4 Drive"      "Hornet Sportabout" 
[6] "Valiant"             "Duster 360"          "Merc 240D"           "Merc 230"            "Merc 280"          
[11] "Merc 280C"           "Merc 450SE"          "Merc 450SL"          "Merc 450SLC"         "Cadillac Fleetwood"
[16] "Lincoln Continental" "Chrysler Imperial"   "Fiat 128"            "Honda Civic"         "Toyota Corolla"    
[21] "Toyota Corona"       "Dodge Challenger"    "AMC Javelin"         "Camaro Z28"          "Pontiac Firebird"  
[26] "Fiat X1-9"           "Porsche 914-2"       "Lotus Europa"        "Ford Pantera L"      "Ferrari Dino"      
[31] "Maserati Bora"       "Volvo 142E"

If you want to know column names, you can use two commands

colnames(carpart) # colnames is a specific function
[1] "mpg"  "cyl"  "disp" "hp" 
names(carpart)# names only work work for dataframes
[1] "mpg"  "cyl"  "disp" "hp"

You can change the column names/row names by assign the new names in order, lets check the column names.

names(carpart)
[1] "mpg" "cyl" "disp" "hp"

Now assign with new name

names(carpart)<- c("miles/gal","cylinder","displacement","horsepower")
# or
colnames(carpart)<- c("miles/gal","cylinder","displacement","horsepower")

In conclusion, the first class of an R programming journey is a foundational step towards mastering this versatile and powerful language. As you delve into R, you'll find yourself equipped with the essential knowledge of its syntax, data structures, and basic programming concepts. This initial exposure sets the stage for more advanced topics like data manipulation, visualization, and statistical analysis, which are at the heart of R's capabilities. Whether you're a data scientist, statistician, or just someone interested in data-driven insights, the skills you acquire in this first class will serve as the building blocks for your future exploration and expertise in the world of R programming. So, embrace this beginning with enthusiasm, for it opens the door to a realm of endless possibilities in data analysis and beyond. 

Python: A Guide to Customizing Themes in Jupyter

  Hey there, Folks! It's been a while, hasn't it? Today, I'm excited to share a neat trick that'll make your Jupyter Lab or...