The following example is to find latitude and longitude of a city from the data worldcities (https://datahub.io/core/world-cities) and then based on the latitude and longitude to slice data from era5 data of this city. It also can be used to find data from other source spatial data. Answer other questions: How to read netcdf file ..
Category : Data
The global historical climate network daily data (ghcnd) is the widely used global climate data for all purposes. However, the data size is huge. If you only want to use data from a certain area, your best bet is to find the site information first, and then download the data for those weather stations directly. ..
We often use running averages to remove noise from time series. Below is a simple python code to do this easily. import numpy as np from numpy import random import matplotlib.pyplot as plt # your data data = random.random(size=(1,100)) # set window kernel_size = 10 # window width is 10 # set weight, you can ..
Xarray data is often used in huge spatial datasets. We often need to fetch data in subregions. The following example shows you how to extract subset data from a large xarray. import numpy as np import xarray as xr #set the sub domain box min_lon = 100 min_lat = 20 max_lon = 150 max_lat = ..
The example provided here is to read a geotiff file; get data in the box and convert it to an array; get the corresponding latitude and longitude of the box. import numpy as np import rasterio import rasterio.plot #!pip install geotiff #https://pypi.org/project/geotiff/ from geotiff import GeoTiff # use rasterio to read geotiff file data_name = ..
My example of Python code for mapping variables overlay with geographic information. Elements in the map include ocean, coastline,borders,lakes,rivers,province borders, contour, contourf, pcolormesh, scatter, labels, province (or state) names. Also includes information about how to set cmap, what range of the data (minimum, maximum) to show, how many levels to display the data. How to ..
Introduction This article includes some Python functions for calculating the core climate extreme index. I post them here for my future reference, and share them with people who are interested in python or climate change. No guarantee of accuracy. The definitions of the core climate extreme indices 1.Description of Climate Extreme Indexes by OCDP 2.Definitions ..
On October 28, the total number of new cases of COVID19 worldwide set a record for a single day (530581/Day). More than 20 countries/regions added record new cases of COVID19. They are most European countries. Following coutries covid19 new cases hit record for a single day: #Italy #Germany #Ukraine #Belgium #Poland #Romania #Portugal #Lebanon #Azerbaijan ..
from pyspark.sql import SparkSession from pyspark.sql.types import * #data types from pyspark.sql import functions as F #functions spark=SparkSession.builder.appName(‘XIU-Daily’).getOrCreate() input_fn = ‘s-p-tsx-60-futures_01.csv’ df = spark.read.csv(input_fn,header=True,inferSchema=True) df.show(3) +——————-+—–+ | date|value| +——————-+—–+ |1999-09-07 00:00:00|416.5| |1999-09-08 00:00:00|417.2| |1999-09-09 00:00:00|421.5| +——————-+—–+ df=df.withColumn(‘Date’,F.date_format(‘date’,’yyyy-MM-dd’)) #change date format df=df.withColumn(‘current_date’,F.current_date()) #current date df=df.withColumn(‘year’,F.year(‘date’)) df=df.withColumn(‘month’,F.month(‘date’)) df=df.withColumn(‘dayofmonth’,F.dayofmonth(‘date’)) df=df.withColumn(‘minute’,F.minute(‘date’)) df=df.withColumn(‘second’,F.second(‘date’)) df=df.withColumn(‘dayofyear’,F.dayofyear(‘date’)) df=df.withColumn(‘dayofweek’,F.dayofweek(‘date’)) df=df.withColumn(‘weekofyear’,F.weekofyear(‘date’)) df=df.withColumn(‘quarter’,F.quarter(‘date’)) df=df.withColumn(‘next_day_Mon’,F.next_day(‘date’,’Mon’)) df=df.withColumn(‘next_day_Tue’,F.next_day(‘date’,’Tue’)) df=df.withColumn(‘next_day_Wed’,F.next_day(‘date’,’Wed’)) ..
GaussianModel Build-in model: GaussianModel(pdf) Build-in model: GaussianModel (CDF) LorentzianModel Build-in model: LorentzianModel(pdf) Build-in model: LorentzianModel (CDF) SplitLorentzianModel VoigtModel Build-in model: VoigtModel(pdf) Build-in model: VoigtModel (CDF) PseudoVoigtModel SkewedVoigtModel MoffatModel Build-in model:MoffatModel Pearson7Model Build-in model: Pearson7Model(pdf) StudentsTModel Build-in model: StudentsTModel(pdf) Build-in model: StudentsTModel (CDF) BreitWignerModel Build-in model: BreitWignerModel(pdf) LognormalModel Build-in model: LognormalModel(pdf) Build-in model: LognormalModel (CDF) DampedOcsillatorModel ..