Skip to content

Instantly share code, notes, and snippets.

View nmathewa's full-sized avatar
🎯
Focusing

nmathewa

🎯
Focusing
  • Florida Institute of Technology
  • Melbourne, FL , USA
  • 07:32 (UTC -04:00)
View GitHub Profile
@nmathewa
nmathewa / .py
Last active February 26, 2021 02:51
importing libraries
import wrf
import pandas as pd
import numpy as np
import plotly.figure_factory as FF
import plotly.graph_objects as go
import time
from scipy.spatial import Delaunay
from netCDF4 import Dataset
direc = "wrfoutput_location"
datain = Dataset(direc)
@nmathewa
nmathewa / new_GTiff.py
Created March 4, 2021 14:19
new_GTiff
"""
Created on Thu Mar 4 19:14:00 2021
@author: nma
"""
import numpy as np
from osgeo import gdal,gdal_array
@nmathewa
nmathewa / multi_refere.py
Created March 4, 2021 14:37
multi_reference.py
"""
Created on Thu Mar 4 19:14:00 2021
@author: nma
"""
import numpy as np
from osgeo import gdal,osr
@nmathewa
nmathewa / gdal_.py
Created March 4, 2021 14:59
use_gdal_py
"""
Created on Thu Mar 4 19:14:00 2021
@author: nma
"""
import os
raster_f = "A_raster_file.tif"
raster_s = "B_raster_file.tif"
@nmathewa
nmathewa / gdal_numpy_calc.py
Created March 4, 2021 15:14
gdal_numpy_calc
"""
Created on Thu Mar 4 19:14:00 2021
@author: nma
"""
from osgeo import gdal,gdal_array,gdalconst,osr
import numpy as np
raster_f = "A_raster_file.tif"
raster_s = "B_raster_file.tif"
@nmathewa
nmathewa / gdal_resample.py
Created March 4, 2021 15:29
gdal_resample
"""
Created on Thu Mar 4 19:14:00 2021
@author: nma
"""
from osgeo import gdal
## file to be converted
in_file = "in_file.tif"
inn = gdal.Open(in_file,gdalconst.GA_ReadOnly)
@nmathewa
nmathewa / sci_net_create.py
Last active April 19, 2021 12:50
scipy_netcdf_create
from scipy.io import netcdf as nc
import numpy as np
#creatin an sample fil
net = nc.netcdf_file("test.nc",'w')
#making an attribute inside the netCDF file similarly an template can be created
net.author = "Made by NMA"
#creating dimension and its length
net.createDimension('time',10)
# setting up space for values for dimensions and variabls (name , datatype , (dims))
@nmathewa
nmathewa / xr_nc.py
Created May 19, 2021 12:44
netcdf using xarray
"""
Created on Wed May 19 17:55:14 2021
@author: mathew
"""
import xarray as xr
import numpy as np
@nmathewa
nmathewa / nc_np_sub.py
Last active May 24, 2021 14:12
Netcdf pytfon subset using numpy
import numpy as np
from netCDF4 import Dataset
nc = "your_file.nc"
dset = Dataset(nc)
lats = dset.variables["lat"][:]
lons = dset.variables["lon"][:]
@nmathewa
nmathewa / cart_nc.py
Last active May 28, 2021 16:58
cartopy spatial map netcdf4
"""
Created on Fri May 28 21:15:01 2021
@author: mathew
"""
import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as ccrs