GAMAP tips and tricks: Difference between revisions

From Geos-chem
Jump to navigation Jump to search
No edit summary
 
(174 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Memory management and CTM_MAKE_DATAINFO ==
----
<span style="color:red"><big><strong>[https://geoschem.github.io/gamap-manual/GAMAP GAMAP] is now obsolete.  We recommend using [https://gcpy.readthedocs.io GCPy] for analyzing output from recent GEOS-Chem versions.  But we will preserve the GAMAP wiki documentation for reference.</strong></big></span>
----


When using CTM_MAKE_DATAINFO, you create few pointers and allocate memory to pointed data. Three scenarios to free that memory are possible.


(1) By default, GAMAP keeps track of the pointers in a global structure, and you can clean up the memory by calling CTM_CLEANUP (with or without the keyword /NO_GC):
On this page we list information about GAMAP, the Global Atmospheric Model Analysis Package. 


    ctm_make_datainfo(data, ...)
== Overview ==
    CTM_WriteBpch, DataInfo, FileInfo, FileName=file
    ctm_cleanup


(2) If you use the keyword /NO_GLOBAL when calling CTM_MAKE_DATAINFO, the story is a little bit more subtle. Now, GAMAP has no idea of the created pointers. If you use CTM_CLEANUP without the keyword /NO_GC, everything is clean up because there is a call to heap_gc. But you are also loosing **all other** pointers and objects.
GAMAP


    ctm_make_datainfo(data, ..., /No_global)
* is a self-contained, consistent, and user-friendly software package for reading and visualizing output from chemical tracer models (CTM's)
    CTM_WriteBpch, DataInfo, FileInfo, FileName=file
* consists of a suite of routines written in IDL (Interactive Data Language)
    ctm_cleanup
* makes extensive use of IDL's powerful plotting features
* can produce line plots, 2D plots, 2D animations, or 3D isocontour surface plots
* can read 2D, 3D or 4D data blocks
* can read output from the GEOS–Chem, GISS and FSU model families
* can be easily customized to keep pace with ongoing model development
* can be installed on any platform that supports IDL, thus ensuring a high degree of portability
* can be coupled with the ION (IDL on the Net) interface to create interactive plots which can be served to a web page
* can read data from ASCII, binary, netCDF (including COARDS conventions!), and HDF–EOS file formats
* contains helper routines to read from / write to various file formats


Note if you do not call ctm_cleanup or call it with /No_GC, then the memory allocated by CTM_MAKE_DATAINFO is still allocated and the pointers that refers to it are alive... until you exit the routine (unless they are passed back). Once you are out of the routine, this memory remains allocated but is useless since unaccessible, in other words you have memory leak.
The main GAMAP program contains a user-friendly, menu-driven interface; however, users may also call GAMAP subroutines independently of the main program. This makes it possible to embed GAMAP routines within existing IDL code.  


== Table of Contents ==


(3) So, if you want to keep some objects and/or pointers alive in your code (i.e., you do not want to call heap_gc or ctm_cleanup,/no_gc), you need to free only the created pointers as follows:
=== GAMAP web pages ===


    ctm_make_datainfo(data, datainfo, fileinfo, ..., /No_global)
* [https://geoschem.github.io/gamap-manual/ GAMAP main page]
    CTM_WriteBpch, DataInfo, FileInfo, FileName=file
* [https://geoschem.github.io/gamap-manual/doc/index.html GAMAP Online User's Guide]
    ptr_free, DataInfo.data
    ptr_free, fileinfo.gridinfo


To free only the heap memory created by multiple calls to CTM_MAKE_DATAINFO, the procedure is:
=== GAMAP tips and tricks ===


  for D=0L, NTracers-1L do begin
* [[General GAMAP usage]]
     
* [[File I/O with GAMAP]]
      Success = CTM_Make_DataInfo( Data[*,*,D], DataInfo, FileInfo, ..., /No_Global )
* [[Color and graphics with GAMAP]]
     
* [[Regridding with GAMAP]]
      ArrDataInfo = D eq 0l ? [ DataInfo ] : [ ArrDataInfo, DataInfo ]
* [[Date and time computations with GAMAP]]
     
* [[Text manipulation with GAMAP]]
      if D ne Ntracers-1l then ptr_free, Fileinfo.gridinfo
* [[Removing extraneous lines from map plots]]
     
* [[TVMAP cheat sheet]]
  endfor
* [[Reading binary files in IDL]]
     
  CTM_WriteBpch, ArrDataInfo, FileInfo, FileName=OutFileName
     
  for d=0, n_elements(ArrDataInfo)-1l do ptr_free, ArrDataInfo[d].data
  ptr_free, fileinfo.gridinfo


'''--[[plesager@seas.harvard.edu|Phillipe Le Sager]] 2008/02/13 10:28'''
--[[User:Bmy|Bob Y.]] 09:48, 11 March 2011 (EST)

Latest revision as of 19:02, 16 September 2022


GAMAP is now obsolete. We recommend using GCPy for analyzing output from recent GEOS-Chem versions. But we will preserve the GAMAP wiki documentation for reference.



On this page we list information about GAMAP, the Global Atmospheric Model Analysis Package.

Overview

GAMAP

  • is a self-contained, consistent, and user-friendly software package for reading and visualizing output from chemical tracer models (CTM's)
  • consists of a suite of routines written in IDL (Interactive Data Language)
  • makes extensive use of IDL's powerful plotting features
  • can produce line plots, 2D plots, 2D animations, or 3D isocontour surface plots
  • can read 2D, 3D or 4D data blocks
  • can read output from the GEOS–Chem, GISS and FSU model families
  • can be easily customized to keep pace with ongoing model development
  • can be installed on any platform that supports IDL, thus ensuring a high degree of portability
  • can be coupled with the ION (IDL on the Net) interface to create interactive plots which can be served to a web page
  • can read data from ASCII, binary, netCDF (including COARDS conventions!), and HDF–EOS file formats
  • contains helper routines to read from / write to various file formats

The main GAMAP program contains a user-friendly, menu-driven interface; however, users may also call GAMAP subroutines independently of the main program. This makes it possible to embed GAMAP routines within existing IDL code.

Table of Contents

GAMAP web pages

GAMAP tips and tricks

--Bob Y. 09:48, 11 March 2011 (EST)