Skip to content

Latest commit

 

History

History
112 lines (83 loc) · 2.74 KB

File metadata and controls

112 lines (83 loc) · 2.74 KB

PyPIOMAS

Overview

This package currently supports

  1. downloading the PIOMAS dataset;
  2. converting scalar fields with a 2-d grid type to an NetCDF format.

This package is written in Python 3 by Weiming Hu. The implementation is inspired from the following similar projects:

  1. Zack Labe's tools
  2. Robbie Mallet’s converters

Installation

Recommended From GitHub: pip install git+https://github.com/uga-gaim/PyPIOMAS.git

Usage

An example is provided in Example.py.

In a nutshell, you start by defining a downloader.

from PyPIOMAS.PyPIOMAS import PyPIOMAS

variables = ['area']
years = [2016, 2017, 2018]
out_dir = '~/Desktop/PIOMAS'

downloader = PyPIOMAS(out_dir, variables, years)

You can check your configuration by printing the downloader.

>>> print(downloader)
*************** PIOMAS Data Downloader ***************
Source: http://psc.apl.uw.edu/research/projects/arctic-sea-ice-volume-anomaly/data/model_grid
Save to directory: /Users/wuh20/Desktop/PIOMAS
Variables: area
Years: 2016, 2017, 2018
************************* End ************************

Then, you can download the data. If the data are compressed, you can also unzip them afterwards.

downloader.download()
downloader.unzip()

PyPIOMAS also provides the functionality to convert the raw data to NetCDF.

downloader.to_netcdf('PIOMAS.nc')

Finally, this is what you get.

% ncdump -h PIOMAS.nc 
netcdf PIOMAS {
dimensions:
	grid = 43200 ;
	year = 3 ;
	month = 12 ;
variables:
	double x(grid) ;
		x:_FillValue = NaN ;
	double y(grid) ;
		y:_FillValue = NaN ;
	int64 year(year) ;
	double area(year, month, grid) ;
		area:_FillValue = NaN ;
		area:long_name = "Monthly sea ice concentration" ;
		area:units = "" ;
		area:coordinates = "x y" ;
}

Enjoy your science!

Contribution

Tickets and pull requests are always welcome!

# "`-''-/").___..--''"`-._
#  (`6_ 6  )   `-.  (     ).`-.__.`)   WE ARE ...
#  (_Y_.)'  ._   )  `._ `. ``-..-'    PENN STATE!
#    _ ..`--'_..-_/  /--'_.' ,'
#  (il),-''  (li),'  ((!.-'
# 
# Author: 
#     Weiming Hu <weiming@psu.edu>
#
# Geoinformatics and Earth Observation Laboratory (http://geolab.psu.edu)
# Department of Geography and Institute for Computational and Data Sciences
# The Pennsylvania State University