Coder Social home page Coder Social logo

jaclark5 / hwm93 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from space-physics/hwm93

0.0 0.0 0.0 250 KB

NASA Horizontal Wind Model HWM93 in Python and Matlab

Home Page: https://ccmc.gsfc.nasa.gov/pub/modelweb/atmospheric/hwm93/

License: MIT License

CMake 11.04% Python 60.22% MATLAB 13.02% Shell 15.73%

hwm93's Introduction

Build Status Coverage Status Build status PyPi version PyPi Download stats

HWM93 in Python

NASA Horizontal Wind Model HWM93 in Python โ‰ฅ 3.6

image

Works with many Fortran compilers, including:

  • Gfortran 5, 6, 7, 8
  • Intel ifort
  • PGI pgf90
  • Nvidia flang

Install

A Fortran compiler such as gfortran is needed. We use f2py (part of numpy) to seamlessly use Fortran libraries from Python. If you don't have a Fortran compiler, here is how to install Gfortran:

  • Linux: apt install gfortran

  • Mac: brew install gcc

  • Windows

    pip install -e .

test by

pytest -sv

Windows

If you get ImportError on Windows for the Fortran module, try from the hwm93 directory:

del *.pyd
python setup.py build_ext --inplace --compiler=mingw32

Usage

HWM93 can be used from the command line or as an imported Python module in other programs. Matlab also can use HWM93.

Command line

RunHWM93 -h

Write data to NetCDF (HDF5) with -o option.

import module

import hwm93
from datetime import datetime

winds = hwm93.run(t=datetime(2017,11,12,8), altkm=150., 
                    glat=65., glon=-148., f107a=150, f107=150, ap=4)

winds is an xarray.Dataset

 <xarray.Dataset>
Dimensions:     (alt_km: 1)
Coordinates:
  * alt_km      (alt_km) float64 150.0
Data variables:
    meridional  (alt_km) float64 4.827
    zonal       (alt_km) float64 -20.5
Attributes:
    time:     2017-11-12T08:00:00
    glat:     65.0
    glon:     -148.0

If you want just a single variable, say

print(winds.zonal.values)

Matlab

You can import this Python module from Matlab as in hwm93.m.

Notes

[Optional] Fortran-only use

Most users don't need this.

cd bin
cmake ..
cmake --build .
ctest -V

or

f2py -c src/hwm93_sub.f  -m hwm93 only: gws5 :

Reference

Original A. E. Hedin Fortran 77 HWM93 code

hwm93's People

Contributors

scivision avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.